mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
fixed seg fault in registry frontend caused by trying to
use a destroyed TALLOC_CTX*
This commit is contained in:
parent
bc0f1c1ec2
commit
432b9f8d7c
@ -420,6 +420,8 @@ void* sorted_tree_find( SORTED_TREE *tree, char *key )
|
||||
} while ( base && current );
|
||||
|
||||
/* result should be the data_p from the lowest match node in the tree */
|
||||
if ( result )
|
||||
DEBUG(10,("sorted_tree_find: Found data_p!\n"));
|
||||
|
||||
SAFE_FREE( keystr );
|
||||
|
||||
|
@ -69,15 +69,20 @@ BOOL reghook_cache_add( REGISTRY_HOOK *hook )
|
||||
REGISTRY_HOOK* reghook_cache_find( char *keyname )
|
||||
{
|
||||
char *key;
|
||||
int len;
|
||||
|
||||
if ( !keyname )
|
||||
return NULL;
|
||||
|
||||
if ( (key = strdup( keyname )) == NULL ) {
|
||||
DEBUG(0,("reghook_cache_find: strdup() failed for string [%s] !?!?!\n",
|
||||
|
||||
len = strlen( keyname );
|
||||
if ( !(key = malloc( len + 2 )) ) {
|
||||
DEBUG(0,("reghook_cache_find: malloc failed for string [%s] !?!?!\n",
|
||||
keyname));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*key = '\\';
|
||||
strncpy( key+1, keyname, len+1);
|
||||
|
||||
string_sub( key, "\\", "/", 0 );
|
||||
|
||||
|
@ -43,12 +43,14 @@ static BOOL init_registry_data( void )
|
||||
|
||||
/* HKEY_LOCAL_MACHINE */
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
regsubkey_ctr_addkey( &subkeys, "SYSTEM" );
|
||||
if ( !regdb_store_reg_keys( keyname, &subkeys ))
|
||||
return False;
|
||||
regsubkey_ctr_destroy( &subkeys );
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
pstrcat( keyname, "/SYSTEM" );
|
||||
regsubkey_ctr_addkey( &subkeys, "CurrentControlSet" );
|
||||
@ -56,6 +58,7 @@ static BOOL init_registry_data( void )
|
||||
return False;
|
||||
regsubkey_ctr_destroy( &subkeys );
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
pstrcat( keyname, "/SYSTEM/CurrentControlSet" );
|
||||
regsubkey_ctr_addkey( &subkeys, "Control" );
|
||||
@ -64,6 +67,7 @@ static BOOL init_registry_data( void )
|
||||
return False;
|
||||
regsubkey_ctr_destroy( &subkeys );
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
pstrcat( keyname, "/SYSTEM/CurrentControlSet/Control" );
|
||||
regsubkey_ctr_addkey( &subkeys, "Print" );
|
||||
@ -77,6 +81,7 @@ static BOOL init_registry_data( void )
|
||||
if ( !regdb_store_reg_keys( keyname, &subkeys ))
|
||||
return False;
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
pstrcat( keyname, "/SYSTEM/CurrentControlSet/services" );
|
||||
regsubkey_ctr_addkey( &subkeys, "Netlogon" );
|
||||
@ -84,6 +89,7 @@ static BOOL init_registry_data( void )
|
||||
return False;
|
||||
regsubkey_ctr_destroy( &subkeys );
|
||||
|
||||
regsubkey_ctr_init( &subkeys );
|
||||
pstrcpy( keyname, KEY_HKLM );
|
||||
pstrcat( keyname, "/SYSTEM/CurrentControlSet/services/Netlogon" );
|
||||
regsubkey_ctr_addkey( &subkeys, "parameters" );
|
||||
|
@ -248,11 +248,10 @@ char* regsubkey_ctr_specific_key( REGSUBKEY_CTR *ctr, uint32 key_index )
|
||||
|
||||
void regsubkey_ctr_destroy( REGSUBKEY_CTR *ctr )
|
||||
{
|
||||
if ( ctr )
|
||||
talloc_destroy( ctr->ctx );
|
||||
|
||||
ctr->num_subkeys = 0;
|
||||
ctr->subkeys = NULL;
|
||||
if ( ctr ) {
|
||||
talloc_destroy( ctr->ctx );
|
||||
ZERO_STRUCTP( ctr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -285,10 +284,9 @@ int regval_ctr_numvals( REGVAL_CTR *ctr )
|
||||
|
||||
void regval_ctr_destroy( REGVAL_CTR *ctr )
|
||||
{
|
||||
if ( ctr )
|
||||
if ( ctr ) {
|
||||
talloc_destroy( ctr->ctx );
|
||||
|
||||
ctr->num_values = 0;
|
||||
ctr->values = NULL;
|
||||
ZERO_STRUCTP( ctr );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user