From b0e50c6a7d5b9a2d466018dcdf546e3289bffbc1 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 11 Apr 2009 03:40:12 +0000 Subject: [PATCH] ITS#6054 assert/exit on failed allocs --- servers/slapd/sl_malloc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/servers/slapd/sl_malloc.c b/servers/slapd/sl_malloc.c index a5d8760b64..998d50bd8a 100644 --- a/servers/slapd/sl_malloc.c +++ b/servers/slapd/sl_malloc.c @@ -267,11 +267,19 @@ slap_sl_malloc( int i, j; #ifdef SLAP_NO_SL_MALLOC - return ber_memalloc_x( size, NULL ); + newptr = ber_memalloc_x( size, NULL ); + if ( newptr ) return newptr; + assert( 0 ); + exit( EXIT_FAILURE ); #endif /* ber_set_option calls us like this */ - if (!ctx) return ber_memalloc_x(size, NULL); + if (!ctx) { + newptr = ber_memalloc_x( size, NULL ); + if ( newptr ) return newptr; + assert( 0 ); + exit( EXIT_FAILURE ); + } /* round up to doubleword boundary */ size += sizeof(ber_len_t) + pad; @@ -375,7 +383,10 @@ slap_sl_realloc(void *ptr, ber_len_t size, void *ctx) return slap_sl_malloc(size, ctx); #ifdef SLAP_NO_SL_MALLOC - return ber_memrealloc_x( ptr, size, NULL ); + newptr = ber_memrealloc_x( ptr, size, NULL ); + if ( newptr ) return newptr; + assert( 0 ); + exit( EXIT_FAILURE ); #endif /* Not our memory? */ -- 2.39.5