diff options
Diffstat (limited to 'source3/iniparser/src/iniparser.c')
-rw-r--r-- | source3/iniparser/src/iniparser.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/iniparser/src/iniparser.c b/source3/iniparser/src/iniparser.c index 67f42a347d..0cb452b265 100644 --- a/source3/iniparser/src/iniparser.c +++ b/source3/iniparser/src/iniparser.c @@ -259,7 +259,9 @@ char * iniparser_getstring(dictionary * d, const char * key, char * def) if (d==NULL || key==NULL) return def ; - lc_key = strdup(strlwc(key)); + if (!(lc_key = strdup(strlwc(key)))) { + return NULL; + } sval = dictionary_get(d, lc_key, def); free(lc_key); return sval ; @@ -462,7 +464,10 @@ dictionary * iniparser_load(const char * ininame) /* * Initialize a new dictionary entry */ - d = dictionary_new(0); + if (!(d = dictionary_new(0))) { + fclose(ini); + return NULL; + } lineno = 0 ; while (fgets(lin, ASCIILINESZ, ini)!=NULL) { lineno++ ; |