diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-22 23:25:09 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-22 23:25:09 +0000 |
commit | 1ce67b7672ab58afd76d0ad9cc0343e688c6770d (patch) | |
tree | 98443b5eacdf6f81e81f6c71e5a17141372126e5 /source3/lib | |
parent | dea7597767e690168e9485dfc2efabaab2dfb4cb (diff) | |
download | samba-1ce67b7672ab58afd76d0ad9cc0343e688c6770d.tar.gz samba-1ce67b7672ab58afd76d0ad9cc0343e688c6770d.tar.bz2 samba-1ce67b7672ab58afd76d0ad9cc0343e688c6770d.zip |
Valgrind found a few memory leaks!
Andrew Bartlett
(This used to be commit fb680f610ceb9a0f350c99456cf7ab1a507543fe)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/gencache.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index eb0e0cd808..40b4d1390d 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); |