From: Andreas Schneider Date: Thu, 22 Apr 2021 13:25:57 +0000 (+0200) Subject: lib:replace: Fix possible resource leaks in test_closefrom() X-Git-Tag: tevent-0.11.0~1037 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16d1abb63ebc6a5566238c1077b5623b18e87643;p=thirdparty%2Fsamba.git lib:replace: Fix possible resource leaks in test_closefrom() Found by covscan Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Sun Apr 25 22:02:20 UTC 2021 on sn-devel-184 --- 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; } }