mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 16:49:39 -05:00
Use ber_mem* and friends
This commit is contained in:
parent
f9a560114a
commit
c57e5952f9
1 changed files with 9 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue