summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-02-24 23:17:05 +0100
committerMichael Adam <obnox@samba.org>2009-02-26 13:22:52 +0100
commitea2b74090dc58d9d6ac9e78746994d0ebce7ca9e (patch)
tree7af09bf2f35297133ac238c4adfb9c678902388d /source3/registry
parentcd8bfd3a84a02cdaf74813bb7c09dc9a02621aa6 (diff)
downloadsamba-ea2b74090dc58d9d6ac9e78746994d0ebce7ca9e.tar.gz
samba-ea2b74090dc58d9d6ac9e78746994d0ebce7ca9e.tar.bz2
samba-ea2b74090dc58d9d6ac9e78746994d0ebce7ca9e.zip
s3:registry: use regsubkey_ctr_init() in reg_api.c
instead of using talloc on struct regsubkey_ctr. Michael
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_api.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index 6e0e342dba..66296f0ddd 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -94,15 +94,16 @@ static WERROR fill_value_cache(struct registry_key *key)
static WERROR fill_subkey_cache(struct registry_key *key)
{
+ WERROR werr;
+
if (key->subkeys != NULL) {
if (!reg_subkeys_need_update(key->key, key->subkeys)) {
return WERR_OK;
}
}
- if (!(key->subkeys = TALLOC_ZERO_P(key, struct regsubkey_ctr))) {
- return WERR_NOMEM;
- }
+ werr = regsubkey_ctr_init(key, &(key->subkeys));
+ W_ERROR_NOT_OK_RETURN(werr);
if (fetch_reg_keys(key->key, key->subkeys) == -1) {
TALLOC_FREE(key->subkeys);
@@ -193,8 +194,8 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
/* check if the path really exists; failed is indicated by -1 */
/* if the subkey count failed, bail out */
- if ( !(subkeys = TALLOC_ZERO_P( key, struct regsubkey_ctr )) ) {
- result = WERR_NOMEM;
+ result = regsubkey_ctr_init(key, &subkeys);
+ if (!W_ERROR_IS_OK(result)) {
goto done;
}
@@ -751,10 +752,8 @@ static WERROR reg_load_tree(REGF_FILE *regfile, const char *topkeypath,
/* now start parsing the values and subkeys */
- subkeys = TALLOC_ZERO_P(regfile->mem_ctx, struct regsubkey_ctr);
- if (subkeys == NULL) {
- return WERR_NOMEM;
- }
+ result = regsubkey_ctr_init(regfile->mem_ctx, &subkeys);
+ W_ERROR_NOT_OK_RETURN(result);
values = TALLOC_ZERO_P(subkeys, REGVAL_CTR);
if (values == NULL) {
@@ -912,10 +911,8 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath,
/* lookup the values and subkeys */
- subkeys = TALLOC_ZERO_P(regfile->mem_ctx, struct regsubkey_ctr);
- if (subkeys == NULL) {
- return WERR_NOMEM;
- }
+ result = regsubkey_ctr_init(regfile->mem_ctx, &subkeys);
+ W_ERROR_NOT_OK_RETURN(result);
values = TALLOC_ZERO_P(subkeys, REGVAL_CTR);
if (values == NULL) {