Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)

Steven Rostedt
2025-08-01T15:56:33Z

On Fri, 1 Aug 2025 17:34:51 +0200
Tomas Glozar <tglozar@redhat.com> wrote:

> pá 1. 8. 2025 v 17:29 odesílatel Alexei Starovoitov
> <alexei.starovoitov@gmail.com> napsal:
> >
> > but __free() is imo garbage. It's essence of what's wrong with C++
> >
>
> Here, you at least can read the beginning of the function though, and
> see that a free will be done at the end, like Go's defer, right?

I don't know Go, but I'll assume "yes".

I prefer the __free() over goto end; where you need to free up a temporary
variable on error paths.

But regardless. This will just be a difference of opinion, and I respect
that Alexei doesn't want to use it in his code.

-- Steve