Skip to content

Commit

Permalink
Do not close file in iniparser_load_file()
Browse files Browse the repository at this point in the history
iniparser_load_file() did not open the file, so it is not its
responsibility to close it.

refs #158
refs #115
  • Loading branch information
lmoellendorf committed Mar 24, 2024
1 parent cbd3ad2 commit b726472
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/iniparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame)

dict = dictionary_new(0) ;
if (!dict) {
fclose(in);
return NULL ;
}

Expand All @@ -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 */
Expand Down Expand Up @@ -830,7 +828,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame)
dictionary_del(dict);
dict = NULL ;
}
fclose(in);
return dict ;
}

Expand Down Expand Up @@ -859,6 +856,7 @@ dictionary * iniparser_load(const char * ininame)
}

dict = iniparser_load_file(in, ininame);
fclose(in);

return dict ;
}
Expand Down

0 comments on commit b726472

Please sign in to comment.