lkml.org 
[lkml]   [2025]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] selftests/x86/lam: Fix Memory leak fi in do_uring
Date
    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 --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));

--
2.25.1

\
 
 \ /
  Last update: 2025-01-14 09:27    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog