linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf bpf: Fix memory leak during synthesis.
@ 2021-08-26  0:16 Ian Rogers
  2021-08-26  8:02 ` kajoljain
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2021-08-26  0:16 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel
  Cc: eranian, Ian Rogers

BTF needs to be freed with btf_free.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/bpf-event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index cdecda1ddd36..d193104db7f7 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -296,7 +296,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
 
 out:
 	free(info_linear);
-	free(btf);
+	btf__free(btf);
 	return err ? -1 : 0;
 }
 
-- 
2.33.0.rc2.250.ged5fa647cd-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf bpf: Fix memory leak during synthesis.
  2021-08-26  0:16 [PATCH] perf bpf: Fix memory leak during synthesis Ian Rogers
@ 2021-08-26  8:02 ` kajoljain
  2021-08-26 18:49   ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: kajoljain @ 2021-08-26  8:02 UTC (permalink / raw)
  To: Ian Rogers, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users, linux-kernel
  Cc: eranian



On 8/26/21 5:46 AM, Ian Rogers wrote:
> BTF needs to be freed with btf_free.
> 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/bpf-event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> index cdecda1ddd36..d193104db7f7 100644
> --- a/tools/perf/util/bpf-event.c
> +++ b/tools/perf/util/bpf-event.c
> @@ -296,7 +296,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
>  
>  out:
>  	free(info_linear);
> -	free(btf);
> +	btf__free(btf);

Hi Ian,
   Patch looks good to me. I can see in one more place we are using free(btf) in the
same file. Can you correct that as well.

Thanks,
Kajol Jain
   
>  	return err ? -1 : 0;
>  }
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf bpf: Fix memory leak during synthesis.
  2021-08-26  8:02 ` kajoljain
@ 2021-08-26 18:49   ` Ian Rogers
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2021-08-26 18:49 UTC (permalink / raw)
  To: kajoljain
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel, eranian

On Thu, Aug 26, 2021 at 1:02 AM kajoljain <kjain@linux.ibm.com> wrote:
>
>
>
> On 8/26/21 5:46 AM, Ian Rogers wrote:
> > BTF needs to be freed with btf_free.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/perf/util/bpf-event.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> > index cdecda1ddd36..d193104db7f7 100644
> > --- a/tools/perf/util/bpf-event.c
> > +++ b/tools/perf/util/bpf-event.c
> > @@ -296,7 +296,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
> >
> >  out:
> >       free(info_linear);
> > -     free(btf);
> > +     btf__free(btf);
>
> Hi Ian,
>    Patch looks good to me. I can see in one more place we are using free(btf) in the
> same file. Can you correct that as well.

Done. Also found 1 more in annotate :-)
https://lore.kernel.org/lkml/20210826184833.408563-1-irogers@google.com/T/#u

Thanks,
Ian

> Thanks,
> Kajol Jain
>
> >       return err ? -1 : 0;
> >  }
> >
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-26 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26  0:16 [PATCH] perf bpf: Fix memory leak during synthesis Ian Rogers
2021-08-26  8:02 ` kajoljain
2021-08-26 18:49   ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).