diff options
author | Hengqi Chen <hengqi.chen@gmail.com> | 2022-03-19 04:05:33 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-03-21 15:36:52 +0100 |
commit | d0f325c34c2fbe15f6774f2b628224280b571ae9 (patch) | |
tree | 2e6bfcf60c1bc849dc47e8fe622f756251c8d392 /tools/lib | |
parent | bpftool: Fix print error when show bpf map (diff) | |
download | linux-d0f325c34c2fbe15f6774f2b628224280b571ae9.tar.xz linux-d0f325c34c2fbe15f6774f2b628224280b571ae9.zip |
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/lib')
-rw-r--r-- | tools/lib/bpf/libbpf.c | 2 |
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; |