1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

(merge from HEAD) Valgrind found some memory leaks!

This commit is contained in:
Andrew Bartlett 0001-01-01 00:00:00 +00:00
parent 70634d248e
commit 8315b9c311
3 changed files with 15 additions and 2 deletions

View File

@ -114,6 +114,9 @@ BOOL gencache_set(const char *keystr, const char *value, time_t timeout)
if (!gencache_init()) return False;
asprintf(&valstr, CACHE_DATA_FMT, (int)timeout, value);
if (!valstr)
return False;
keybuf.dptr = strdup(keystr);
keybuf.dsize = strlen(keystr)+1;
databuf.dptr = strdup(valstr);
@ -241,6 +244,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
keybuf.dptr = strdup(keystr);
keybuf.dsize = strlen(keystr)+1;
databuf = tdb_fetch(cache, keybuf);
SAFE_FREE(keybuf.dptr);
if (databuf.dptr && databuf.dsize > TIMEOUT_LEN) {
char* entry_buf = strndup(databuf.dptr, databuf.dsize);

View File

@ -118,6 +118,7 @@ BOOL namecache_store(const char *name, int name_type,
time_t expiry;
char *key, *value_string;
int i;
BOOL ret;
/*
* 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
* 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 */
return (gencache_set(key, value_string, expiry));
ret = gencache_set(key, value_string, expiry);
SAFE_FREE(key);
SAFE_FREE(value_string);
return ret;
}

View File

@ -2954,6 +2954,7 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
break;
case P_LIST:
str_list_free(parm_ptr);
*(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
break;