[strongSwan-dev] [PATCH 1/3] Fix file descriptor leak on error

Thomas Jarosch thomas.jarosch at intra2net.com
Fri Aug 26 20:55:55 CEST 2011


Credit goes to cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com>
---
 src/libstrongswan/settings.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/libstrongswan/settings.c b/src/libstrongswan/settings.c
index 8a2248b..b26fbeb 100644
--- a/src/libstrongswan/settings.c
+++ b/src/libstrongswan/settings.c
@@ -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);
-- 
1.7.4.4





More information about the Dev mailing list