mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf:fix a resource leak
@ 2024-06-27  6:01 Zhu Jun
  2024-06-28 22:23 ` Daniel Borkmann
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Jun @ 2024-06-27  6:01 UTC (permalink / raw)
  To: shuah
  Cc: ast, daniel, andrii, martin.lau, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, mykolal, bpf,
	linux-kselftest, linux-kernel, Zhu Jun

The requested resources should be closed before return
in main(), otherwise resource leak will occur

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 tools/testing/selftests/bpf/test_sockmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index a34e95040994..03d5dd617c4a 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -2092,7 +2092,7 @@ int main(int argc, char **argv)
 	if (err) {
 		fprintf(stderr, "populate program: (%s) %s\n",
 			bpf_file, strerror(errno));
-		return 1;
+		goto out;
 	}
 	running = 1;
 
-- 
2.17.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-01  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-27  6:01 [PATCH] selftests/bpf:fix a resource leak Zhu Jun
2024-06-28 22:23 ` Daniel Borkmann
2024-07-01  2:13   ` Zhu Jun
2024-07-01  9:27     ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®