summaryrefslogtreecommitdiffstats
path: root/source3/lib/adt_tree.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-07 18:25:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:32 -0500
commitacf9d61421faa6c0055d57fdee7db300dc5431aa (patch)
tree5482afecfe9b4a68b9a1f18d541a3109f8143ab7 /source3/lib/adt_tree.c
parent3bd3be97dc8a581c0502410453091c195e322766 (diff)
downloadsamba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.gz
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.xz
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.zip
r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
Diffstat (limited to 'source3/lib/adt_tree.c')
-rw-r--r--source3/lib/adt_tree.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c
index bd857e205ac..a5d6380377e 100644
--- a/source3/lib/adt_tree.c
+++ b/source3/lib/adt_tree.c
@@ -59,7 +59,7 @@ SORTED_TREE* sorted_tree_init( void *data_p,
{
SORTED_TREE *tree = NULL;
- if ( !(tree = (SORTED_TREE*)malloc( sizeof(SORTED_TREE) )) )
+ if ( !(tree = SMB_MALLOC_P(SORTED_TREE)) )
return NULL;
ZERO_STRUCTP( tree );
@@ -67,7 +67,7 @@ SORTED_TREE* sorted_tree_init( void *data_p,
tree->compare = cmp_fn;
tree->free_func = free_fn;
- if ( !(tree->root = (TREE_NODE*)malloc( sizeof(TREE_NODE) )) ) {
+ if ( !(tree->root = SMB_MALLOC_P(TREE_NODE)) ) {
SAFE_FREE( tree );
return NULL;
}
@@ -126,15 +126,15 @@ static TREE_NODE* sorted_tree_birth_child( TREE_NODE *node, char* key )
TREE_NODE **siblings;
int i;
- if ( !(infant = (TREE_NODE*)malloc( sizeof(TREE_NODE) )) )
+ if ( !(infant = SMB_MALLOC_P(TREE_NODE)) )
return NULL;
ZERO_STRUCTP( infant );
- infant->key = strdup( key );
+ infant->key = SMB_STRDUP( key );
infant->parent = node;
- siblings = Realloc( node->children, sizeof(TREE_NODE*)*(node->num_children+1) );
+ siblings = SMB_REALLOC_ARRAY( node->children, TREE_NODE *, node->num_children+1 );
if ( siblings )
node->children = siblings;
@@ -260,7 +260,7 @@ BOOL sorted_tree_add( SORTED_TREE *tree, const char *path, void *data_p )
/* move past the first '/' */
path++;
- path2 = strdup( path );
+ path2 = SMB_STRDUP( path );
if ( !path2 ) {
DEBUG(0,("sorted_tree_add: strdup() failed on string [%s]!?!?!\n", path));
return False;
@@ -405,9 +405,9 @@ void* sorted_tree_find( SORTED_TREE *tree, char *key )
/* make a copy to play with */
if ( *key == '/' )
- keystr = strdup( key+1 );
+ keystr = SMB_STRDUP( key+1 );
else
- keystr = strdup( key );
+ keystr = SMB_STRDUP( key );
if ( !keystr ) {
DEBUG(0,("sorted_tree_find: strdup() failed on string [%s]!?!?!\n", key));