Skip to content

Commit 7882d8f

Browse files
qiyeliuakpm00
authored andcommitted
selftests/mm/mkdirty: fix memory leak in test_uffdio_copy()
Release memory before exception branch returns to prevent memory leaks Checking tools/testing/selftests/mm/mkdirty.c ... tools/testing/selftests/mm/mkdirty.c:283:3: error: Memory leak: src [memleak] return; ^ Link: https://lkml.kernel.org/r/20250114023838.48589-1-liuye@kylinos.cn Signed-off-by: liuye <liuye@kylinos.cn> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 92da988 commit 7882d8f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/testing/selftests/mm/mkdirty.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ static void test_uffdio_copy(void)
280280
dst = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0);
281281
if (dst == MAP_FAILED) {
282282
ksft_test_result_fail("mmap() failed\n");
283+
free(src);
283284
return;
284285
}
285286

0 commit comments

Comments
 (0)