1 /* ch_malloc.c - malloc routines that test returns from malloc and friends */
3 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/stdlib.h>
13 #include <ac/string.h>
14 #include <ac/socket.h>
25 if ( (new = (void *) ber_memalloc( size )) == NULL ) {
26 Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
43 if ( block == NULL ) {
44 return( ch_malloc( size ) );
51 if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
52 Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
69 if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
70 Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
71 (long) nelem, (long) size, 0 );
86 if ( (new = ber_strdup( string )) == NULL ) {
87 Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );