summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHengqi Chen <hengqi.chen@gmail.com>2022-03-19 06:05:33 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2022-03-21 17:36:52 +0300
commitd0f325c34c2fbe15f6774f2b628224280b571ae9 (patch)
tree2e6bfcf60c1bc849dc47e8fe622f756251c8d392 /tools
parent1824d8ea75f275a5e69e5f6bc0ffe122ea9b938c (diff)
downloadlinux-d0f325c34c2fbe15f6774f2b628224280b571ae9.tar.xz
libbpf: Close fd in bpf_object__reuse_map
pin_fd is dup-ed and assigned in bpf_map__reuse_fd. Close it in bpf_object__reuse_map after reuse. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20220319030533.3132250-1-hengqi.chen@gmail.com
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/bpf/libbpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 2efe9431c1ba..809fe209cdcc 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4823,8 +4823,8 @@ bpf_object__reuse_map(struct bpf_map *map)
}
err = bpf_map__reuse_fd(map, pin_fd);
+ close(pin_fd);
if (err) {
- close(pin_fd);
return err;
}
map->pinned = true;