diff options
author | David Disseldorp <ddiss@samba.org> | 2014-10-06 18:21:17 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-10-06 19:18:05 +0200 |
commit | 3c854657531ac73ce5e3148e35844e3c8130fe37 (patch) | |
tree | b08764a8166ef566dbfb61d1b4236f570f6980cd /source3/libsmb/samlogon_cache.c | |
parent | 21ed8058d2e295e93c9df8e954de28478a060e94 (diff) | |
download | samba-3c854657531ac73ce5e3148e35844e3c8130fe37.tar.gz |
samlogon_cache: don't leak cache_path onto talloc tos
Also check for allocation failures.
Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb/samlogon_cache.c')
-rw-r--r-- | source3/libsmb/samlogon_cache.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index 0a157d48463..1f1ab1d46e8 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -38,7 +38,7 @@ static TDB_CONTEXT *netsamlogon_tdb = NULL; bool netsamlogon_cache_init(void) { bool first_try = true; - const char *path = NULL; + char *path = NULL; int ret; struct tdb_context *tdb; @@ -47,6 +47,9 @@ bool netsamlogon_cache_init(void) } path = cache_path(NETSAMLOGON_TDB); + if (path == NULL) { + return false; + } again: tdb = tdb_open_log(path, 0, TDB_DEFAULT|TDB_INCOMPATIBLE_HASH, O_RDWR | O_CREAT, 0600); @@ -63,10 +66,12 @@ again: } netsamlogon_tdb = tdb; + talloc_free(path); return true; clear: if (!first_try) { + talloc_free(path); return false; } first_try = false; |