git.samba.org
/
bbaumbach
/
samba-autobuild
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib:replace: Fix possible resource leaks in test_closefrom()
[bbaumbach/samba-autobuild/.git]
/
lib
/
replace
/
tests
/
testsuite.c
diff --git
a/lib/replace/tests/testsuite.c
b/lib/replace/tests/testsuite.c
index c51a29740e91e484bfb92a1d225aa2b4e9dbcdcf..d8afa15480b031324cbd988f0fe708e487d6791e 100644
(file)
--- 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");
fd = dup(0);
if (fd == -1) {
perror("dup failed");
+ closefrom(3);
return false;
}
return false;
}
@@
-1096,6
+1097,7
@@
static bool test_closefrom(void)
if (fd >= 1000) {
printf("fd=%d\n", fd);
if (fd >= 1000) {
printf("fd=%d\n", fd);
+ closefrom(3);
return false;
}
}
return false;
}
}