diff options
author | Gerald Carter <jerry@samba.org> | 2005-08-29 14:55:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:03:25 -0500 |
commit | 44707ad2e00a91f459e80efbe8f362b5853b0a62 (patch) | |
tree | 438124f4550315df722d959891b66e669222f8e8 /source3/utils/profiles.c | |
parent | 77670a2ec33275ae08a37606ee15bf0170b7fcb3 (diff) | |
download | samba-44707ad2e00a91f459e80efbe8f362b5853b0a62.tar.gz samba-44707ad2e00a91f459e80efbe8f362b5853b0a62.tar.bz2 samba-44707ad2e00a91f459e80efbe8f362b5853b0a62.zip |
r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to use
the new talloc() features:
Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d
since the methods use the object pointer as the talloc context for
internal private data.
There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy()
pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the
object.
Also had to convert the printer_info_2->NT_PRINTER_DATA field
to be talloc()'d as well. This is just a stop on the road to
cleaning up the printer memory management.
(This used to be commit ef721333ab9639cb5346067497e99fbd0d4425dd)
Diffstat (limited to 'source3/utils/profiles.c')
-rw-r--r-- | source3/utils/profiles.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index 284e15230a..52970bdffc 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -67,8 +67,8 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, { REGF_NK_REC *key, *subkey; SEC_DESC *new_sd; - REGVAL_CTR values; - REGSUBKEY_CTR subkeys; + REGVAL_CTR *values; + REGSUBKEY_CTR *subkeys; int i; pstring path; @@ -82,23 +82,30 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, if ( swap_sid_in_acl( new_sd, &old_sid, &new_sid ) ) DEBUG(2,("Updating ACL for %s\n", nk->keyname )); - regsubkey_ctr_init( &subkeys ); - regval_ctr_init( &values ); + if ( !(subkeys = TALLOC_ZERO_P( NULL, REGSUBKEY_CTR )) ) { + DEBUG(0,("copy_registry_tree: talloc() failure!\n")); + return False; + } + + if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) ) { + DEBUG(0,("copy_registry_tree: talloc() failure!\n")); + return False; + } /* copy values into the REGVAL_CTR */ for ( i=0; i<nk->num_values; i++ ) { - regval_ctr_addvalue( &values, nk->values[i].valuename, nk->values[i].type, + regval_ctr_addvalue( values, nk->values[i].valuename, nk->values[i].type, nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) ); } /* copy subkeys into the REGSUBKEY_CTR */ while ( (subkey = regfio_fetch_subkey( infile, nk )) ) { - regsubkey_ctr_addkey( &subkeys, subkey->keyname ); + regsubkey_ctr_addkey( subkeys, subkey->keyname ); } - key = regfio_write_key( outfile, nk->keyname, &values, &subkeys, new_sd, parent ); + key = regfio_write_key( outfile, nk->keyname, values, subkeys, new_sd, parent ); /* write each one of the subkeys out */ @@ -110,8 +117,9 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, return False; } - regval_ctr_destroy( &values ); - regsubkey_ctr_destroy( &subkeys ); + /* values is a talloc()'d child of subkeys here so just throw it all away */ + + TALLOC_FREE( subkeys ); DEBUG(1,("[%s]\n", path)); |