X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fch_malloc.c;h=3e634dae51253dfc09c8c1056f9f9b7f4eddd230;hb=eb6b2650091656bde96fbbdb87a5b8154cdc319b;hp=8bfedb803e3bbea7afd703e1448abf64a0cafa11;hpb=1372965d8941fbe3bb8d51ef9ce2a81e07a0c203;p=openldap diff --git a/servers/slapd/ch_malloc.c b/servers/slapd/ch_malloc.c index 8bfedb803e..3e634dae51 100644 --- a/servers/slapd/ch_malloc.c +++ b/servers/slapd/ch_malloc.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2007 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,13 +52,8 @@ ch_malloc( void *new; if ( (new = (void *) ber_memalloc_x( size, NULL )) == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG( OPERATION, ERR, - "ch_malloc: allocation of %lu bytes failed\n", (long)size, 0,0 ); -#else Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n", (long) size, 0, 0 ); -#endif assert( 0 ); exit( EXIT_FAILURE ); } @@ -80,6 +75,7 @@ ch_realloc( if( size == 0 ) { ch_free( block ); + return NULL; } ctx = slap_sl_context( block ); @@ -88,13 +84,8 @@ ch_realloc( } if ( (new = (void *) ber_memrealloc_x( block, size, NULL )) == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG( OPERATION, ERR, - "ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 ); -#else Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n", (long) size, 0, 0 ); -#endif assert( 0 ); exit( EXIT_FAILURE ); } @@ -111,14 +102,8 @@ ch_calloc( void *new; if ( (new = (void *) ber_memcalloc_x( nelem, size, NULL )) == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG( OPERATION, ERR, - "ch_calloc: allocation of %lu elements of %lu bytes faild\n", - (long)nelem, (long)size, 0 ); -#else Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n", (long) nelem, (long) size, 0 ); -#endif assert( 0 ); exit( EXIT_FAILURE ); } @@ -134,12 +119,7 @@ ch_strdup( char *new; if ( (new = ber_strdup_x( string, NULL )) == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG( OPERATION, ERR, - "chr_strdup: duplication of \"%s\" failed\n", string, 0, 0 ); -#else Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 ); -#endif assert( 0 ); exit( EXIT_FAILURE ); }