]> git.sur5r.net Git - openldap/commitdiff
Converted ch_malloc and ch_calloc calls to SLAP_MALLOC and SLAP_CALLOC.
authorJulius Enarusai <julius@openldap.org>
Tue, 19 Nov 2002 18:24:18 +0000 (18:24 +0000)
committerJulius Enarusai <julius@openldap.org>
Tue, 19 Nov 2002 18:24:18 +0000 (18:24 +0000)
servers/slapd/sasl.c
servers/slapd/schema_init.c

index 53c0c5bfea1145fb450bf9f357b68095534c4668..da408fc394f549229b40b00d9f087a8a2857109b 100644 (file)
@@ -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;
index 5409bc1e002969ca07af2155b6e96591380517d1..e25d9a7abee867c90b9de07d8e6a19186adb36fc 100644 (file)
@@ -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],