Skip to content

Commit d0f325c

Browse files
chenhengqiborkmann
authored andcommitted
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 1824d8e commit d0f325c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4823,8 +4823,8 @@ bpf_object__reuse_map(struct bpf_map *map)
48234823
}
48244824

48254825
err = bpf_map__reuse_fd(map, pin_fd);
4826+
close(pin_fd);
48264827
if (err) {
4827-
close(pin_fd);
48284828
return err;
48294829
}
48304830
map->pinned = true;

0 commit comments

Comments
 (0)