From: Julius Enarusai Date: Tue, 19 Nov 2002 18:24:18 +0000 (+0000) Subject: Converted ch_malloc and ch_calloc calls to SLAP_MALLOC and SLAP_CALLOC. X-Git-Tag: NO_SLAP_OP_BLOCKS~795 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe569dbb7517dbb8bf1905c4f87732197114c4cf;p=openldap Converted ch_malloc and ch_calloc calls to SLAP_MALLOC and SLAP_CALLOC. --- diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 53c0c5bfea..da408fc394 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -398,7 +398,17 @@ int slap_sasl_getdn( Connection *conn, char *id, int len, /* Build the new dn */ c1 = dn->bv_val; - dn->bv_val = ch_malloc( len+1 ); + dn->bv_val = SLAP_MALLOC( len+1 ); + if( dn->bv_val == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( TRANSPORT, ERR, + "slap_sasl_getdn: SLAP_MALLOC failed", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "slap_sasl_getdn: SLAP_MALLOC failed", 0, 0, 0 ); +#endif + return LDAP_OTHER; + } p = lutil_strcopy( dn->bv_val, "uid=" ); p = lutil_strncopy( p, c1, dn->bv_len ); @@ -1209,10 +1219,20 @@ int slap_sasl_open( Connection *conn ) session_callbacks = #if SASL_VERSION_MAJOR >= 2 - ch_calloc( 5, sizeof(sasl_callback_t)); + SLAP_CALLOC( 5, sizeof(sasl_callback_t)); #else - ch_calloc( 3, sizeof(sasl_callback_t)); + SLAP_CALLOC( 3, sizeof(sasl_callback_t)); #endif + if( session_callbacks == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( TRANSPORT, ERR, + "slap_sasl_open: SLAP_MALLOC failed", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "slap_sasl_open: SLAP_MALLOC failed", 0, 0, 0 ); +#endif + return -1; + } conn->c_sasl_extra = session_callbacks; session_callbacks[cb=0].id = SASL_CB_LOG; diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 5409bc1e00..e25d9a7abe 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -706,7 +706,7 @@ UTF8SubstringsassertionNormalize( SubstringsAssertion *nsa; int i; - nsa = (SubstringsAssertion *)ch_calloc( 1, sizeof(SubstringsAssertion) ); + nsa = (SubstringsAssertion *)SLAP_CALLOC( 1, sizeof(SubstringsAssertion) ); if( nsa == NULL ) { return NULL; } @@ -723,7 +723,10 @@ UTF8SubstringsassertionNormalize( /* empty */ } nsa->sa_any = (struct berval *) - ch_malloc( (i + 1) * sizeof(struct berval) ); + SLAP_MALLOC( (i + 1) * sizeof(struct berval) ); + if( nsa->sa_any == NULL ) { + goto err; + } for( i=0; sa->sa_any[i].bv_val != NULL; i++ ) { UTF8bvnormalize( &sa->sa_any[i], &nsa->sa_any[i],