[systemd-devel] [PATCH 1/3] [file handle leak] Close file handle when we're done with it

philippedeswert at gmail.com philippedeswert at gmail.com
Wed Sep 10 12:14:39 PDT 2014


From: Philippe De Swert <philippedeswert at gmail.com>

In test_read_one_char the filehandle does not get its fclose
at the end of the function, thus we are leaking fd's.

Found with Coverity. Fixes: CID#1237749

Signed-off-by: Philippe De Swert <philippedeswert at gmail.com>
---
 src/test/test-util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test-util.c b/src/test/test-util.c
index 72a8a6b..0d36711 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -947,6 +947,7 @@ static void test_read_one_char(void) {
         assert_se(read_one_char(file, &r, 1000000, &need_nl) < 0);
 
         unlink(name);
+        fclose(file);
 }
 
 static void test_ignore_signals(void) {
-- 
1.8.3.2



More information about the systemd-devel mailing list