linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: Add missing free.
@ 2024-09-27  3:01 zhangjiao2
  2024-09-27  7:25 ` Muhammad Usama Anjum
  2024-09-27 12:23 ` David Hildenbrand
  0 siblings, 2 replies; 3+ messages in thread
From: zhangjiao2 @ 2024-09-27  3:01 UTC (permalink / raw)
  To: akpm; +Cc: shuah, linux-mm, linux-kselftest, linux-kernel, zhang jiao

From: zhang jiao <zhangjiao2@cmss.chinamobile.com>

There is a memory leak in mkdirty, just free src before return.

Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
---
 tools/testing/selftests/mm/mkdirty.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c
index 1db134063c38..af2fce496912 100644
--- a/tools/testing/selftests/mm/mkdirty.c
+++ b/tools/testing/selftests/mm/mkdirty.c
@@ -280,6 +280,7 @@ static void test_uffdio_copy(void)
 	dst = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0);
 	if (dst == MAP_FAILED) {
 		ksft_test_result_fail("mmap() failed\n");
+		free(src);
 		return;
 	}
 
-- 
2.33.0





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

end of thread, other threads:[~2024-09-27 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-27  3:01 [PATCH] selftests/mm: Add missing free zhangjiao2
2024-09-27  7:25 ` Muhammad Usama Anjum
2024-09-27 12:23 ` David Hildenbrand

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