diff options
Diffstat (limited to 'source3/iniparser/src/dictionary.c')
-rw-r--r-- | source3/iniparser/src/dictionary.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/iniparser/src/dictionary.c b/source3/iniparser/src/dictionary.c index 1f55cb4c24..edbd6f9a35 100644 --- a/source3/iniparser/src/dictionary.c +++ b/source3/iniparser/src/dictionary.c @@ -114,7 +114,9 @@ dictionary * dictionary_new(int size) /* If no size was specified, allocate space for DICTMINSZ */ if (size<DICTMINSZ) size=DICTMINSZ ; - d = (dictionary *)calloc(1, sizeof(dictionary)); + if (!(d = (dictionary *)calloc(1, sizeof(dictionary)))) { + return NULL; + } d->size = size ; d->val = (char **)calloc(size, sizeof(char*)); d->key = (char **)calloc(size, sizeof(char*)); @@ -355,6 +357,10 @@ void dictionary_unset(dictionary * d, char * key) unsigned hash ; int i ; + if (key == NULL) { + return; + } + hash = dictionary_hash(key); for (i=0 ; i<d->size ; i++) { if (d->key[i]==NULL) |