Skip to content
Snippets Groups Projects
Commit c57e5952 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Use ber_mem* and friends

parent f9a56011
Branches
Tags
No related merge requests found
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment