mirror of
https://github.com/samba-team/samba.git
synced 2025-08-05 12:22:11 +03:00
r19928: Fix klokwork id 4509, 4573, 4574.
(This used to be commit c004d04181
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
78a0932145
commit
985248b638
@ -114,7 +114,9 @@ dictionary * dictionary_new(int size)
|
|||||||
/* If no size was specified, allocate space for DICTMINSZ */
|
/* If no size was specified, allocate space for DICTMINSZ */
|
||||||
if (size<DICTMINSZ) size=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->size = size ;
|
||||||
d->val = (char **)calloc(size, sizeof(char*));
|
d->val = (char **)calloc(size, sizeof(char*));
|
||||||
d->key = (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 ;
|
unsigned hash ;
|
||||||
int i ;
|
int i ;
|
||||||
|
|
||||||
|
if (key == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hash = dictionary_hash(key);
|
hash = dictionary_hash(key);
|
||||||
for (i=0 ; i<d->size ; i++) {
|
for (i=0 ; i<d->size ; i++) {
|
||||||
if (d->key[i]==NULL)
|
if (d->key[i]==NULL)
|
||||||
|
@ -259,7 +259,9 @@ char * iniparser_getstring(dictionary * d, const char * key, char * def)
|
|||||||
if (d==NULL || key==NULL)
|
if (d==NULL || key==NULL)
|
||||||
return def ;
|
return def ;
|
||||||
|
|
||||||
lc_key = strdup(strlwc(key));
|
if (!(lc_key = strdup(strlwc(key)))) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
sval = dictionary_get(d, lc_key, def);
|
sval = dictionary_get(d, lc_key, def);
|
||||||
free(lc_key);
|
free(lc_key);
|
||||||
return sval ;
|
return sval ;
|
||||||
@ -462,7 +464,10 @@ dictionary * iniparser_load(const char * ininame)
|
|||||||
/*
|
/*
|
||||||
* Initialize a new dictionary entry
|
* Initialize a new dictionary entry
|
||||||
*/
|
*/
|
||||||
d = dictionary_new(0);
|
if (!(d = dictionary_new(0))) {
|
||||||
|
fclose(ini);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
lineno = 0 ;
|
lineno = 0 ;
|
||||||
while (fgets(lin, ASCIILINESZ, ini)!=NULL) {
|
while (fgets(lin, ASCIILINESZ, ini)!=NULL) {
|
||||||
lineno++ ;
|
lineno++ ;
|
||||||
|
Reference in New Issue
Block a user