From: Jiri Olsa Date: Fri, 19 Jan 2024 11:05:00 +0000 (+0100) Subject: bpftool: Fix wrong free call in do_show_link X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2adb2e0fcdf3c6d8e28a5a9c33e458e1037ae5ad;p=linux.git bpftool: Fix wrong free call in do_show_link The error path frees wrong array, it should be ref_ctr_offsets. Acked-by: Yafang Shao Reviewed-by: Quentin Monnet Fixes: a7795698f8b6 ("bpftool: Add support to display uprobe_multi links") Signed-off-by: Jiri Olsa Acked-by: Song Liu Link: https://lore.kernel.org/r/20240119110505.400573-4-jolsa@kernel.org Signed-off-by: Alexei Starovoitov --- diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c index cb46667a6b2e7..35b6859dd7c3d 100644 --- a/tools/bpf/bpftool/link.c +++ b/tools/bpf/bpftool/link.c @@ -977,7 +977,7 @@ again: cookies = calloc(count, sizeof(__u64)); if (!cookies) { p_err("mem alloc failed"); - free(cookies); + free(ref_ctr_offsets); free(offsets); close(fd); return -ENOMEM;