[PATCH 5/6] samlogon_cache: don't leak cache_path onto talloc tos
David Disseldorp
ddiss at samba.org
Mon Oct 6 10:21:17 MDT 2014
Also check for allocation failures.
Reported-by: Franz Pförtsch <franz.pfoertsch at brose.com>
Signed-off-by: David Disseldorp <ddiss at samba.org>
---
source3/libsmb/samlogon_cache.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index 0a157d4..1f1ab1d 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;
--
1.8.4.5
More information about the samba-technical
mailing list