1 /* ch_malloc.c - malloc routines that test returns from malloc and friends */
4 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
14 #include <ac/stdlib.h>
16 #include <ac/string.h>
17 #include <ac/socket.h>
30 if ( (new = (void *) ber_memalloc( size )) == NULL ) {
31 Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
48 if ( block == NULL ) {
49 return( ch_malloc( size ) );
56 if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
57 Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
74 if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
75 Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
76 (long) nelem, (long) size, 0 );
91 if ( (new = ber_strdup( string )) == NULL ) {
92 Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );