lib: Fix CID 1034840 Resource leak
authorVolker Lendecke <vl@samba.org>
Sun, 8 Mar 2015 19:12:11 +0000 (19:12 +0000)
committerVolker Lendecke <vl@samba.org>
Tue, 10 Mar 2015 20:48:04 +0000 (21:48 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
lib/replace/test/testsuite.c

index 4c2fc1293e18153126c041bf86aaaf48437abe20..017b8ede730d10b327d6ade58eaa16046c094148 100644 (file)
@@ -977,6 +977,7 @@ static int test_utimes(void)
                printf("failure: utimes [\n"
                       "fstat (1) failed - %s\n]\n",
                       strerror(errno));
+               close(fd);
                return false;
        }
 
@@ -987,6 +988,7 @@ static int test_utimes(void)
                printf("failure: utimes [\n"
                       "utimes(tv) failed - %s\n]\n",
                       strerror(errno));
+               close(fd);
                return false;
        }
 
@@ -994,6 +996,7 @@ static int test_utimes(void)
                printf("failure: utimes [\n"
                       "fstat (2) failed - %s\n]\n",
                       strerror(errno));
+               close(fd);
                return false;
        }
 
@@ -1003,6 +1006,7 @@ static int test_utimes(void)
                       "%s: %s(%d) != %s(%d)\n]\n", \
                       __location__, \
                       #a, (int)a, #b, (int)b); \
+               close(fd); \
                return false; \
        } \
 } while(0)
@@ -1014,6 +1018,7 @@ static int test_utimes(void)
 
        unlink(TESTFILE);
        printf("success: utimes\n");
+       close(fd);
        return true;
 }