summaryrefslogtreecommitdiff
path: root/source3/lib
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/lib
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/lib')
-rw-r--r--source3/lib/gencache.c4
1 files changed, 4 insertions, 0 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);