]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/referral.c
ITS#2368 - fix deleting key from range IDL
[openldap] / servers / slapd / referral.c
index e9b187a734c76bf5bff6283ee882cae4cdf66a38..dccd862b7a37e8809657c8230e37a02b42e83be0 100644 (file)
@@ -1,7 +1,7 @@
 /* referral.c - muck with referrals */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -101,7 +101,17 @@ static char * referral_dn_muck(
                        }
 
                        muck.bv_len = ntargetDN.bv_len + nrefDN.bv_len - nbaseDN.bv_len;
-                       muck.bv_val = ch_malloc( muck.bv_len + 1 );
+                       muck.bv_val = SLAP_MALLOC( muck.bv_len + 1 );
+                       if( muck.bv_val == NULL ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG( OPERATION, CRIT, 
+                                       "referral_dn_muck: SLAP_MALLOC failed\n", 0, 0, 0 );
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "referral_dn_muck: SLAP_MALLOC failed\n", 0, 0, 0 );
+#endif
+                               return NULL;
+                       }
 
                        strncpy( muck.bv_val, ntargetDN.bv_val,
                                ntargetDN.bv_len-nbaseDN.bv_len );
@@ -225,7 +235,17 @@ BerVarray referral_rewrite(
 
        if( i < 1 ) return NULL;
 
-       refs = ch_malloc( (i+1) * sizeof( struct berval ) );
+       refs = SLAP_MALLOC( (i+1) * sizeof( struct berval ) );
+       if( refs == NULL ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG( OPERATION, CRIT, 
+                       "referral_rewrite: SLAP_MALLOC failed\n", 0, 0, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "referral_rewrite: SLAP_MALLOC failed\n", 0, 0, 0 );
+#endif
+               return NULL;
+       }
 
        for( iv=in,jv=refs; iv->bv_val != NULL ; iv++ ) {
                LDAPURLDesc *url;
@@ -294,7 +314,17 @@ BerVarray get_entry_referrals(
 
        if( i < 1 ) return NULL;
 
-       refs = ch_malloc( (i + 1) * sizeof(struct berval));
+       refs = SLAP_MALLOC( (i + 1) * sizeof(struct berval));
+       if( refs == NULL ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG( OPERATION, CRIT, 
+                       "get_entry_referrals: SLAP_MALLOC failed\n", 0, 0, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "get_entry_referrals: SLAP_MALLOC failed\n", 0, 0, 0 );
+#endif
+               return NULL;
+       }
 
        for( iv=attr->a_vals, jv=refs; iv->bv_val != NULL; iv++ ) {
                unsigned k;