From 614e7d565d92bd20b22e162f286b14edcf924489 Mon Sep 17 00:00:00 2001 From: Julius Enarusai Date: Tue, 19 Nov 2002 21:26:09 +0000 Subject: [PATCH] Converted ch_malloc and ch_calloc calls to SLAP_MALLOC and SLAP_CALLOC. --- servers/slapd/mods.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c index 403ee8e9bd..9af70141e2 100644 --- a/servers/slapd/mods.c +++ b/servers/slapd/mods.c @@ -73,7 +73,17 @@ modify_check_duplicates( /* count existing values */ ; if ( numvals < nummods ) { - nvals = ch_calloc( numvals + 1, sizeof( struct berval ) ); + nvals = SLAP_CALLOC( numvals + 1, sizeof( struct berval ) ); + if( nvals == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, ERR, + "modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 ); +#endif + goto return_results; + } /* normalize the existing values first */ for ( j = 0; vals[ j ].bv_val != NULL; j++ ) { @@ -98,7 +108,17 @@ modify_check_duplicates( * values and test each new value against them first, * then to other already normalized values */ - nmods = ch_calloc( nummods + 1, sizeof( struct berval ) ); + nmods = SLAP_CALLOC( nummods + 1, sizeof( struct berval ) ); + if( nmods == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, ERR, + "modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "modify_check_duplicates: SLAP_CALLOC failed", 0, 0, 0 ); +#endif + goto return_results; + } for ( i = 0; mods[ i ].bv_val != NULL; i++ ) { rc = value_normalize( ad, SLAP_MR_EQUALITY, @@ -430,7 +450,17 @@ modify_delete_values( for ( j = 0; a->a_vals[ j ].bv_val != NULL; j++ ) /* count existing values */ ; - nvals = (BerVarray)ch_calloc( j + 1, sizeof ( struct berval ) ); + nvals = (BerVarray)SLAP_CALLOC( j + 1, sizeof ( struct berval ) ); + if( nvals == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, ERR, + "modify_delete_values: SLAP_CALLOC failed", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "modify_delete_values: SLAP_CALLOC failed", 0, 0, 0 ); +#endif + goto return_results; + } /* normalize existing values */ for ( j = 0; a->a_vals[ j ].bv_val != NULL; j++ ) { -- 2.39.5