bpftool: Fix wrong free call in do_show_link
authorJiri Olsa <jolsa@kernel.org>
Fri, 19 Jan 2024 11:05:00 +0000 (12:05 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 24 Jan 2024 00:05:27 +0000 (16:05 -0800)
The error path frees wrong array, it should be ref_ctr_offsets.

Acked-by: Yafang Shao <laoar.shao@gmail.com>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Fixes: a7795698f8b6 ("bpftool: Add support to display uprobe_multi links")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240119110505.400573-4-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/link.c

index cb46667a6b2e7c9f823e74b2d746527687822adf..35b6859dd7c3d5edf1dc7fc557912d5223887201 100644 (file)
@@ -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;