summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2021-04-22 15:25:57 +0200
committerJeremy Allison <jra@samba.org>2021-04-25 22:02:19 +0000
commit16d1abb63ebc6a5566238c1077b5623b18e87643 (patch)
treee5486bd087834b57521dd15d0db650bc198e1413 /lib/replace
parenta9ad677eb8527849ac686180c489d7dcb7f76e80 (diff)
downloadsamba-16d1abb63ebc6a5566238c1077b5623b18e87643.tar.gz
lib:replace: Fix possible resource leaks in test_closefrom()
Found by covscan Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sun Apr 25 22:02:20 UTC 2021 on sn-devel-184
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/tests/testsuite.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c
index c51a29740e9..d8afa15480b 100644
--- a/lib/replace/tests/testsuite.c
+++ b/lib/replace/tests/testsuite.c
@@ -1089,6 +1089,7 @@ static bool test_closefrom(void)
fd = dup(0);
if (fd == -1) {
perror("dup failed");
+ closefrom(3);
return false;
}
@@ -1096,6 +1097,7 @@ static bool test_closefrom(void)
if (fd >= 1000) {
printf("fd=%d\n", fd);
+ closefrom(3);
return false;
}
}