Fix file descriptor leak on error
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 26 Aug 2011 18:55:55 +0000 (20:55 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 29 Aug 2011 07:10:28 +0000 (09:10 +0200)
Credit goes to cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
src/libstrongswan/settings.c

index 8a2248b..b26fbeb 100644 (file)
@@ -965,6 +965,7 @@ static bool parse_file(linked_list_t *contents, char *file, int level,
        if (fread(text, 1, len, fd) != len)
        {
                free(text);
+               fclose(fd);
                return FALSE;
        }
        fclose(fd);