summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-02-24 23:18:20 +0100
committerMichael Adam <obnox@samba.org>2009-02-26 13:22:53 +0100
commit3c15d053f543132d434fa0249e3eeeccfeaed43b (patch)
treed09d91604c999db8efc6b7ee8fceb28534477163
parentea2b74090dc58d9d6ac9e78746994d0ebce7ca9e (diff)
downloadsamba-3c15d053f543132d434fa0249e3eeeccfeaed43b.tar.gz
samba-3c15d053f543132d434fa0249e3eeeccfeaed43b.tar.bz2
samba-3c15d053f543132d434fa0249e3eeeccfeaed43b.zip
s3:registry: use regsubkey_ctr_init() in reg_backend_db.c
instead of using talloc directly. Michael
-rw-r--r--source3/registry/reg_backend_db.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 29d0018202..57f10f62a9 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -167,9 +167,9 @@ static WERROR init_registry_key_internal(const char *add_path)
* since we are about to update the record.
* We just want any subkeys already present */
- if (!(subkeys = TALLOC_ZERO_P(frame, struct regsubkey_ctr))) {
+ werr = regsubkey_ctr_init(frame, &subkeys);
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("talloc() failure!\n"));
- werr = WERR_NOMEM;
goto fail;
}
@@ -625,6 +625,7 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)
char *oldkeyname = NULL;
TALLOC_CTX *ctx = talloc_stackframe();
NTSTATUS status;
+ WERROR werr;
if (!regdb_key_is_base_key(key) && !regdb_key_exists(key)) {
goto fail;
@@ -635,7 +636,8 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)
* changed
*/
- if (!(old_subkeys = TALLOC_ZERO_P(ctx, struct regsubkey_ctr))) {
+ werr = regsubkey_ctr_init(ctx, &old_subkeys);
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
return false;
}
@@ -676,7 +678,8 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)
* Re-fetch the old keys inside the transaction
*/
- if (!(old_subkeys = TALLOC_ZERO_P(ctx, struct regsubkey_ctr))) {
+ werr = regsubkey_ctr_init(ctx, &old_subkeys);
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
goto cancel;
}
@@ -796,7 +799,8 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)
num_subkeys = regsubkey_ctr_numkeys(ctr);
if (num_subkeys == 0) {
- if (!(subkeys = TALLOC_ZERO_P(ctx, struct regsubkey_ctr)) ) {
+ werr = regsubkey_ctr_init(ctx, &subkeys);
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
goto cancel;
}
@@ -817,7 +821,8 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr)
if (!path) {
goto cancel;
}
- if (!(subkeys = TALLOC_ZERO_P(ctx, struct regsubkey_ctr)) ) {
+ werr = regsubkey_ctr_init(ctx, &subkeys);
+ if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
goto cancel;
}
@@ -942,6 +947,7 @@ static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
int i, res;
size_t len;
int num_subkeys;
+ WERROR werr;
if (regdb->transaction_start(regdb) != 0) {
DEBUG(0, ("create_sorted_subkeys: transaction_start "
@@ -949,8 +955,8 @@ static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
return false;
}
- ctr = talloc(talloc_tos(), struct regsubkey_ctr);
- if (ctr == NULL) {
+ werr = regsubkey_ctr_init(talloc_tos(), &ctr);
+ if (!W_ERROR_IS_OK(werr)) {
goto fail;
}