diff --git a/halloc_util.c b/halloc_util.c index 5b48e0aeb..f195dca0b 100644 --- a/halloc_util.c +++ b/halloc_util.c @@ -37,7 +37,7 @@ array_list_t *al_halloc( void *context ) if( !res ) DIE_MEM(); al_init( res ); - halloc_register_function( context, (void (*)(void *)) &al_destroy, res ); + halloc_register_function( context?context:res, (void (*)(void *)) &al_destroy, res ); return res; } @@ -47,7 +47,7 @@ string_buffer_t *sb_halloc( void *context ) if( !res ) DIE_MEM(); sb_init( res ); - halloc_register_function( context, (void (*)(void *)) &sb_destroy, res ); + halloc_register_function( context?context:res, (void (*)(void *)) &sb_destroy, res ); return res; }