summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-07-09 00:10:08 +0200
committerMichael Adam <obnox@samba.org>2009-07-15 14:01:53 +0200
commit3eec829e2fa2106c8d52f31e3f3d7f45e6c81b24 (patch)
tree3a12468d85affe41e7a1b01ae855b237747344e4 /source3
parent14f593aa0f43127ab78aec848b0fe5933c0c28c9 (diff)
downloadsamba-3eec829e2fa2106c8d52f31e3f3d7f45e6c81b24.tar.gz
samba-3eec829e2fa2106c8d52f31e3f3d7f45e6c81b24.tar.bz2
samba-3eec829e2fa2106c8d52f31e3f3d7f45e6c81b24.zip
s3:registry: unify exit logic and remove leaking to talloc_stack in regdb_store_keys_internal()
Michael
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_backend_db.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 419bfd00f5..542f6dc7d0 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -727,9 +727,10 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
char *oldkeyname = NULL;
TALLOC_CTX *ctx = talloc_stackframe();
WERROR werr;
+ bool ret = false;
if (!regdb_key_is_base_key(key) && !regdb_key_exists(db, key)) {
- goto fail;
+ goto done;
}
/*
@@ -740,7 +741,7 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
werr = regsubkey_ctr_init(ctx, &old_subkeys);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
- return false;
+ goto done;
}
regdb_fetch_keys_internal(db, key, old_subkeys);
@@ -763,8 +764,9 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
* Nothing changed, no point to even start a tdb
* transaction
*/
- TALLOC_FREE(old_subkeys);
- return true;
+
+ ret = true;
+ goto done;
}
}
@@ -772,7 +774,7 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
if (db->transaction_start(db) != 0) {
DEBUG(0, ("regdb_store_keys: transaction_start failed\n"));
- goto fail;
+ goto done;
}
/*
@@ -896,21 +898,22 @@ static bool regdb_store_keys_internal(struct db_context *db, const char *key,
if (db->transaction_commit(db) != 0) {
DEBUG(0, ("regdb_store_keys: Could not commit transaction\n"));
- goto fail;
+ goto done;
}
- TALLOC_FREE(ctx);
- return true;
+ ret = true;
+ goto done;
cancel:
+ ret = false;
if (db->transaction_cancel(db) != 0) {
smb_panic("regdb_store_keys: transaction_cancel failed\n");
}
-fail:
+done:
TALLOC_FREE(ctx);
- return false;
+ return ret;
}
bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)