]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
tests: fix leak in `test_util_file` ; found by cppcheck
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Mon, 10 Jul 2017 15:00:41 +0000 (18:00 +0300)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 13 Jul 2017 06:05:13 +0000 (09:05 +0300)
Which now seems to fail the build.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
tests/test_util_file.c

index f98dce2e5c9e2fb75ddf51afc8ec5866c4d3c348..5dbdb4774b416df99943a32d7f8583081eee1848 100644 (file)
@@ -106,6 +106,7 @@ static void stat_and_cat(const char *file)
        buf[sb.st_size] = '\0';
        printf("file[%s], size=%d, contents=%s\n", file, (int)sb.st_size, buf);
        free(buf);
+       close(d);
 }
 
 int main(int argc, char **argv)