From c57e5952f9a9239b27f3ea9b1a6fbfcef326ffac Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 19 Jun 1999 05:08:13 +0000 Subject: [PATCH] Use ber_mem* and friends --- servers/slurpd/ch_malloc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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; } - + -- 2.39.5