summaryrefslogtreecommitdiff
path: root/source3/libsmb/namecache.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-03-22 23:32:50 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-03-22 23:32:50 +0000
commit79f3265893a60c9109b02407d15d13f18925c751 (patch)
tree9c5034c144fc441c2811a01b9a15cdb76186572a /source3/libsmb/namecache.c
parentda40f7303ae2546abd26dcccdb04979fbaa98530 (diff)
downloadsamba-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/libsmb/namecache.c')
-rw-r--r--source3/libsmb/namecache.c12
1 files changed, 10 insertions, 2 deletions
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;
}