mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
Assert on malloc failure
This commit is contained in:
parent
aec2f1f17e
commit
70bb39ccbc
1 changed files with 6 additions and 2 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue