Skip to content

Commit b726472

Browse files
committed
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
1 parent cbd3ad2 commit b726472

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/iniparser.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame)
751751

752752
dict = dictionary_new(0) ;
753753
if (!dict) {
754-
fclose(in);
755754
return NULL ;
756755
}
757756

@@ -773,7 +772,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame)
773772
ininame,
774773
lineno);
775774
dictionary_del(dict);
776-
fclose(in);
777775
return NULL ;
778776
}
779777
/* Get rid of \n and spaces at end of line */
@@ -830,7 +828,6 @@ dictionary * iniparser_load_file(FILE * in, const char * ininame)
830828
dictionary_del(dict);
831829
dict = NULL ;
832830
}
833-
fclose(in);
834831
return dict ;
835832
}
836833

@@ -859,6 +856,7 @@ dictionary * iniparser_load(const char * ininame)
859856
}
860857

861858
dict = iniparser_load_file(in, ininame);
859+
fclose(in);
862860

863861
return dict ;
864862
}

0 commit comments

Comments
 (0)