registry: allocate tempory data in talloc stack in regdb_store_keys().
authorMichael Adam <obnox@samba.org>
Mon, 17 Mar 2008 00:02:47 +0000 (01:02 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 17 Mar 2008 07:22:33 +0000 (08:22 +0100)
Michael
(This used to be commit a99b51159a7db5f249ff136cf9ba758d14380a35)

source3/registry/reg_backend_db.c

index 8bfa3526ea82785907c929c24d3ce0bb8d68e9af..8a859301f093a67aa51a5588b811042c285cacaf 100644 (file)
@@ -467,7 +467,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
         * changed
         */
 
-       if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
+       if (!(old_subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR))) {
                DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
                return false;
        }
@@ -504,7 +504,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
         * Re-fetch the old keys inside the transaction
         */
 
-       if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
+       if (!(old_subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR))) {
                DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
                goto cancel;
        }
@@ -574,7 +574,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
        num_subkeys = regsubkey_ctr_numkeys(ctr);
 
        if (num_subkeys == 0) {
-               if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
+               if (!(subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR)) ) {
                        DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
                        goto cancel;
                }
@@ -595,7 +595,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
                if (!path) {
                        goto cancel;
                }
-               if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
+               if (!(subkeys = TALLOC_ZERO_P(ctx, REGSUBKEY_CTR)) ) {
                        DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
                        goto cancel;
                }
@@ -626,8 +626,6 @@ cancel:
        }
 
 fail:
-       TALLOC_FREE(old_subkeys);
-       TALLOC_FREE(subkeys);
        TALLOC_FREE(ctx);
 
        return false;