mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
Valgrind found a few memory leaks!
Andrew Bartlett
This commit is contained in:
@ -114,6 +114,9 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout)
|
|||||||
if (!gencache_init()) return False;
|
if (!gencache_init()) return False;
|
||||||
|
|
||||||
asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value);
|
asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value);
|
||||||
|
if (!valstr)
|
||||||
|
return False;
|
||||||
|
|
||||||
keybuf.dptr = strdup(keystr);
|
keybuf.dptr = strdup(keystr);
|
||||||
keybuf.dsize = strlen(keystr)+1;
|
keybuf.dsize = strlen(keystr)+1;
|
||||||
databuf.dptr = strdup(valstr);
|
databuf.dptr = strdup(valstr);
|
||||||
@ -241,6 +244,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
|
|||||||
keybuf.dptr = strdup(keystr);
|
keybuf.dptr = strdup(keystr);
|
||||||
keybuf.dsize = strlen(keystr)+1;
|
keybuf.dsize = strlen(keystr)+1;
|
||||||
databuf = tdb_fetch(cache, keybuf);
|
databuf = tdb_fetch(cache, keybuf);
|
||||||
|
SAFE_FREE(keybuf.dptr);
|
||||||
|
|
||||||
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
|
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
|
||||||
char* entry_buf = strndup(databuf.dptr, databuf.dsize);
|
char* entry_buf = strndup(databuf.dptr, databuf.dsize);
|
||||||
|
@ -118,6 +118,7 @@ BOOL namecache_store(const char *name, int name_type,
|
|||||||
time_t expiry;
|
time_t expiry;
|
||||||
char *key, *value_string;
|
char *key, *value_string;
|
||||||
int i;
|
int i;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we use gecache call to avoid annoying debug messages about
|
* we use gecache call to avoid annoying debug messages about
|
||||||
@ -152,10 +153,17 @@ BOOL namecache_store(const char *name, int name_type,
|
|||||||
* First, store the number of ip addresses and then
|
* First, store the number of ip addresses and then
|
||||||
* place each single ip
|
* place each single ip
|
||||||
*/
|
*/
|
||||||
ipstr_list_make(&value_string, ip_list, num_names);
|
if (!ipstr_list_make(&value_string, ip_list, num_names)) {
|
||||||
|
SAFE_FREE(key);
|
||||||
|
SAFE_FREE(value_string);
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
/* set the entry */
|
/* set the entry */
|
||||||
return (gencache_set(key, value_string, expiry));
|
ret = gencache_set(key, value_string, expiry);
|
||||||
|
SAFE_FREE(key);
|
||||||
|
SAFE_FREE(value_string);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3183,6 +3183,7 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case P_LIST:
|
case P_LIST:
|
||||||
|
str_list_free(parm_ptr);
|
||||||
*(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
|
*(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user