mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
samples/bpf: Fix a resource leak
The opened file should be closed in show_sockopts(), otherwise resource leak will occur that this problem was discovered by reading code Signed-off-by: Zhu Jun <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
This commit is contained in:
1 parent
c6ca31981b
commit
f3ef53174b
1 file changed
+3
-1
@@ -178,8 +178,10 @@ static int show_sockopts(int family)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (get_bind_to_device(sd, name, sizeof(name)) < 0)
|
||||
if (get_bind_to_device(sd, name, sizeof(name)) < 0) {
|
||||
close(sd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
mark = get_somark(sd);
|
||||
prio = get_priority(sd);
|
||||
|
||||
Reference in new issue
Block a user