]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
registry: don't leak (to talloc_tos()) in regdb_store_keys().
authorMichael Adam <obnox@samba.org>
Sun, 16 Mar 2008 23:41:59 +0000 (00:41 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 17 Mar 2008 07:22:33 +0000 (08:22 +0100)
use talloc_stackframe() and free on error path.

Michael

source/registry/reg_backend_db.c

index f91ddb7d8cd5457be26df3cf098879ee59255bef..13458fe459bb62515150ae5d15cc71efcb565750 100644 (file)
@@ -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");