Re: [PATCH 2/2] perf bpf: Add missing free to bpf_event__print_bpf_prog_info

From: Arnaldo Carvalho de Melo
Date: Sat Nov 06 2021 - 15:03:20 EST


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@xxxxxxxxxx>
> ---
> 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