]> git.sur5r.net Git - openldap/commitdiff
Assert on malloc failure
authorKurt Zeilenga <kurt@openldap.org>
Sat, 14 Aug 1999 01:34:25 +0000 (01:34 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 14 Aug 1999 01:34:25 +0000 (01:34 +0000)
servers/slapd/ch_malloc.c

index 27b7cca7696592b287f1f682cd2cb3b55dc7819d..61bf6d4ee1244b31f61bda72c83ab36075f9e5d6 100644 (file)
@@ -25,7 +25,8 @@ ch_malloc(
        if ( (new = (void *) ber_memalloc( size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
                        (long) size, 0, 0 );
-               exit( EXIT_SUCCESS );
+               assert( 0 );
+               exit( EXIT_FAILURE );
        }
 
        return( new );
@@ -50,7 +51,8 @@ ch_realloc(
        if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
                        (long) size, 0, 0 );
-               exit( EXIT_SUCCESS );
+               assert( 0 );
+               exit( EXIT_FAILURE );
        }
 
        return( new );
@@ -67,6 +69,7 @@ ch_calloc(
        if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
                  (long) nelem, (long) size, 0 );
+               assert( 0 );
                exit( EXIT_FAILURE );
        }
 
@@ -82,6 +85,7 @@ ch_strdup(
 
        if ( (new = ber_strdup( string )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );
+               assert( 0 );
                exit( EXIT_FAILURE );
        }