mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
selftests/mm: gup_longterm: fix a resource leak
The opened file should be closed in run_with_tmpfile(), otherwise resource leak will occur Link: https://lkml.kernel.org/r/20230831093144.7520-1-dingxiang@cmss.chinamobile.com Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
e19a3f595a
commit
b6afcb94ce
|
|
@ -265,10 +265,11 @@ static void run_with_tmpfile(test_fn fn, const char *desc)
|
|||
fd = fileno(file);
|
||||
if (fd < 0) {
|
||||
ksft_test_result_fail("fileno() failed\n");
|
||||
return;
|
||||
goto close;
|
||||
}
|
||||
|
||||
fn(fd, pagesize);
|
||||
close:
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user