diff mbox series

selftests/x86/lam: Fix Memory leak fi in do_uring

Message ID 20250114082650.113105-1-liuye@kylinos.cn (mailing list archive)
State New
Headers show
Series selftests/x86/lam: Fix Memory leak fi in do_uring | expand

Commit Message

liuye Jan. 14, 2025, 8:26 a.m. UTC
Exception branch returns without free fi.
Signed-off-by: liuye <liuye@kylinos.cn>
---
 tools/testing/selftests/x86/lam.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c
index 0ea4f6813930..74f422e76dce 100644
--- a/tools/testing/selftests/x86/lam.c
+++ b/tools/testing/selftests/x86/lam.c
@@ -596,8 +596,10 @@  int do_uring(unsigned long lam)
 	fi->file_fd = file_fd;
 
 	ring = malloc(sizeof(*ring));
-	if (!ring)
+	if (!ring) {
+		free(fi);
 		return 1;
+	}
 
 	memset(ring, 0, sizeof(struct io_ring));