Skip to content

Commit

Permalink
bpf: libbpf: fix memleak by freeing line_info
Browse files Browse the repository at this point in the history
This patch fixes a memory leak in libbpf by freeing up line_info
member of struct bpf_program while unloading a program.

Fixes: 3d65014 ("bpf: libbpf: Add btf_line_info support to libbpf")
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Prashant Bhole authored and Daniel Borkmann committed Dec 18, 2018
1 parent 37c7b1c commit 07a09d1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ void bpf_program__unload(struct bpf_program *prog)

zclose(prog->btf_fd);
zfree(&prog->func_info);
zfree(&prog->line_info);
}

static void bpf_program__exit(struct bpf_program *prog)
Expand Down

0 comments on commit 07a09d1

Please sign in to comment.