From: Kurt Zeilenga Date: Sat, 19 Jun 1999 05:08:13 +0000 (+0000) Subject: Use ber_mem* and friends X-Git-Tag: OPENLDAP_REL_ENG_2_BP~257 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c57e5952f9a9239b27f3ea9b1a6fbfcef326ffac;p=openldap Use ber_mem* and friends --- diff --git a/servers/slurpd/ch_malloc.c b/servers/slurpd/ch_malloc.c index 0adcb7bddf..9f119825fa 100644 --- a/servers/slurpd/ch_malloc.c +++ b/servers/slurpd/ch_malloc.c @@ -36,7 +36,7 @@ ch_malloc( { void *new; - if ( (new = (void *) malloc( size )) == NULL ) { + if ( (new = (void *) ber_memalloc( size )) == NULL ) { fprintf( stderr, "malloc of %lu bytes failed\n", (long) size ); exit( 1 ); @@ -64,7 +64,11 @@ ch_realloc( return( ch_malloc( size ) ); } - if ( (new = (void *) realloc( block, size )) == NULL ) { + if ( size == 0 ) { + ch_free( block ); + } + + if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) { fprintf( stderr, "realloc of %lu bytes failed\n", (long) size ); exit( 1 ); @@ -88,7 +92,7 @@ ch_calloc( { void *new; - if ( (new = (void *) calloc( nelem, size )) == NULL ) { + if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) { fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n", (long) nelem, (long) size ); exit( 1 ); @@ -107,8 +111,8 @@ ch_free( ) { if ( p != NULL ) { - free( p ); + ber_memfree( p ); } return; } - +