From b726472b375101c6fccbf28456dcc28a6d7345b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=B6llendorf?= Date: Sun, 24 Mar 2024 22:29:44 +0100 Subject: [PATCH] Do not close file in iniparser_load_file() iniparser_load_file() did not open the file, so it is not its responsibility to close it. refs #158 refs #115 --- src/iniparser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/iniparser.c b/src/iniparser.c index b24f8b2..0924d06 100644 --- a/src/iniparser.c +++ b/src/iniparser.c @@ -751,7 +751,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame) dict = dictionary_new(0) ; if (!dict) { - fclose(in); return NULL ; } @@ -773,7 +772,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame) ininame, lineno); dictionary_del(dict); - fclose(in); return NULL ; } /* Get rid of \n and spaces at end of line */ @@ -830,7 +828,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame) dictionary_del(dict); dict = NULL ; } - fclose(in); return dict ; } @@ -859,6 +856,7 @@ dictionary * iniparser_load(const char * ininame) } dict = iniparser_load_file(in, ininame); + fclose(in); return dict ; }