summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/lib/gencache.c4
-rw-r--r--source3/libsmb/namecache.c12
-rw-r--r--source3/param/loadparm.c1
3 files changed, 15 insertions, 2 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 6a66ce95b99..baec0e3b376 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -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);
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index 40777011a1d..d3541b7719d 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -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;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 85f92e81ffe..cb03d26e61d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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;