summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-27 19:42:44 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-28 07:57:29 +1000
commitf2d9be5af601741444bc5ff3d91edce38acff024 (patch)
tree58992acd86b6c2f42dda82570e1b095c93b58d44 /source3/passdb
parent5adf8c8634ccc2dc63fb1f64d3dfa11449c78272 (diff)
downloadsamba-f2d9be5af601741444bc5ff3d91edce38acff024.tar.gz
samba-f2d9be5af601741444bc5ff3d91edce38acff024.tar.bz2
samba-f2d9be5af601741444bc5ff3d91edce38acff024.zip
s3-secrets: Use talloc_stackframe() in secrets_init_path()
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/secrets.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index dff855cce6..8f314a76cf 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -59,6 +59,7 @@ bool secrets_init_path(const char *private_dir)
{
char *fname = NULL;
unsigned char dummy;
+ TALLOC_CTX *frame;
if (db_ctx != NULL) {
return True;
@@ -68,9 +69,11 @@ bool secrets_init_path(const char *private_dir)
return False;
}
- fname = talloc_asprintf(talloc_tos(), "%s/secrets.tdb",
+ frame = talloc_stackframe();
+ fname = talloc_asprintf(frame, "%s/secrets.tdb",
private_dir);
if (fname == NULL) {
+ TALLOC_FREE(frame);
return False;
}
@@ -80,11 +83,10 @@ bool secrets_init_path(const char *private_dir)
if (db_ctx == NULL) {
DEBUG(0,("Failed to open %s\n", fname));
+ TALLOC_FREE(frame);
return False;
}
- TALLOC_FREE(fname);
-
/**
* Set a reseed function for the crypto random generator
*
@@ -96,6 +98,7 @@ bool secrets_init_path(const char *private_dir)
/* Ensure that the reseed is done now, while we are root, etc */
generate_random_buffer(&dummy, sizeof(dummy));
+ TALLOC_FREE(frame);
return True;
}