registry: don't leak memory on transaction fail in regdb_store_keys().
authorMichael Adam <obnox@samba.org>
Sun, 16 Mar 2008 23:43:56 +0000 (00:43 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 17 Mar 2008 07:22:33 +0000 (08:22 +0100)
Michael

source/registry/reg_backend_db.c

index 13458fe459bb62515150ae5d15cc71efcb565750..787ca76f89a9f364104e538457ec0bdb3c37f592 100644 (file)
@@ -493,6 +493,8 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
                }
        }
 
+       TALLOC_FREE(old_subkeys);
+
        if (regdb->transaction_start(regdb) == -1) {
                DEBUG(0, ("regdb_store_keys: transaction_start failed\n"));
                return false;
@@ -502,8 +504,6 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
         * Re-fetch the old keys inside the transaction
         */
 
-       TALLOC_FREE(old_subkeys);
-
        if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
                DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
                goto fail;