linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Song Liu <songliubraving@fb.com>,
	linux-kernel@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	linux-perf-users@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/2] perf bpf: Add missing free to bpf_event__print_bpf_prog_info
Date: Sat, 6 Nov 2021 16:03:12 -0300	[thread overview]
Message-ID: <YYbRcJCx4J2pP1UO@kernel.org> (raw)
In-Reply-To: <20211106053733.3580931-2-irogers@google.com>

Em Fri, Nov 05, 2021 at 10:37:33PM -0700, Ian Rogers escreveu:
> If btf__new is called then there needs to be a corresponding btf__free.


Thanks, applied.

- Arnaldo


 
> Fixes: f8dfeae009ef ("perf bpf: Show more BPF program info in print_bpf_prog_info()")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/bpf-event.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
> index 0783b464777a..1f813d8bb946 100644
> --- a/tools/perf/util/bpf-event.c
> +++ b/tools/perf/util/bpf-event.c
> @@ -579,7 +579,7 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
>  		synthesize_bpf_prog_name(name, KSYM_NAME_LEN, info, btf, 0);
>  		fprintf(fp, "# bpf_prog_info %u: %s addr 0x%llx size %u\n",
>  			info->id, name, prog_addrs[0], prog_lens[0]);
> -		return;
> +		goto out;
>  	}
>  
>  	fprintf(fp, "# bpf_prog_info %u:\n", info->id);
> @@ -589,4 +589,6 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
>  		fprintf(fp, "# \tsub_prog %u: %s addr 0x%llx size %u\n",
>  			i, name, prog_addrs[i], prog_lens[i]);
>  	}
> +out:
> +	btf__free(btf);
>  }
> -- 
> 2.34.0.rc0.344.g81b53c2807-goog

-- 

- Arnaldo

  reply	other threads:[~2021-11-06 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06  5:37 [PATCH 1/2] perf bpf: Avoid memory leak from perf_env__insert_btf Ian Rogers
2021-11-06  5:37 ` [PATCH 2/2] perf bpf: Add missing free to bpf_event__print_bpf_prog_info Ian Rogers
2021-11-06 19:03   ` Arnaldo Carvalho de Melo [this message]
2021-11-06 19:01 ` [PATCH 1/2] perf bpf: Avoid memory leak from perf_env__insert_btf Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYbRcJCx4J2pP1UO@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=yangtiezhu@loongson.cn \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).