summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-17 00:41:59 +0100
committerMichael Adam <obnox@samba.org>2008-03-17 08:22:33 +0100
commitba8607acc1d5d5a96363a2eada8b17ca50c6e5f8 (patch)
tree9391fd35f0d20204d9cc7c77e35e8a08f73c00c7 /source3/registry
parenta37811727a32b9f5752321cf0c8533c314aebd5f (diff)
downloadsamba-ba8607acc1d5d5a96363a2eada8b17ca50c6e5f8.tar.gz
samba-ba8607acc1d5d5a96363a2eada8b17ca50c6e5f8.tar.bz2
samba-ba8607acc1d5d5a96363a2eada8b17ca50c6e5f8.zip
registry: don't leak (to talloc_tos()) in regdb_store_keys().
use talloc_stackframe() and free on error path. Michael (This used to be commit 95525772f2791f0fb999fe9f271da5b0fbdc62d8)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_backend_db.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index f91ddb7d8c..13458fe459 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -459,7 +459,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
char *path = NULL;
REGSUBKEY_CTR *subkeys = NULL, *old_subkeys = NULL;
char *oldkeyname = NULL;
- TALLOC_CTX *ctx = talloc_tos();
+ TALLOC_CTX *ctx = talloc_stackframe();
NTSTATUS status;
/*
@@ -623,6 +623,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
fail:
TALLOC_FREE(old_subkeys);
TALLOC_FREE(subkeys);
+ TALLOC_FREE(ctx);
if (regdb->transaction_cancel(regdb) == -1) {
smb_panic("regdb_store_keys: transaction_cancel failed\n");