diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-22 23:32:50 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-22 23:32:50 +0000 |
commit | 79f3265893a60c9109b02407d15d13f18925c751 (patch) | |
tree | 9c5034c144fc441c2811a01b9a15cdb76186572a /source3 | |
parent | da40f7303ae2546abd26dcccdb04979fbaa98530 (diff) | |
download | samba-79f3265893a60c9109b02407d15d13f18925c751.tar.gz samba-79f3265893a60c9109b02407d15d13f18925c751.tar.bz2 samba-79f3265893a60c9109b02407d15d13f18925c751.zip |
(merge from HEAD) Valgrind found some memory leaks!
(This used to be commit 8315b9c3119dde62aeb72ad5e20f63aee89abd0b)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/gencache.c | 4 | ||||
-rw-r--r-- | source3/libsmb/namecache.c | 12 | ||||
-rw-r--r-- | source3/param/loadparm.c | 1 |
3 files changed, 15 insertions, 2 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 6a66ce95b9..baec0e3b37 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 40777011a1..d3541b7719 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 85f92e81ff..cb03d26e61 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; |