]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/attr.c
ITS#2368 - fix deleting key from range IDL
[openldap] / servers / slapd / attr.c
index 047c926762b8273ea7942035626e4d3346606eae..d98ec3cefed171fe50df5985ac62032d92d8078b 100644 (file)
 #include "ldap_pvt.h"
 #include "slap.h"
 
-#ifdef LDAP_DEBUG
-static void at_index_print( void ) 
-{
-}
-#endif
-
 void
 attr_free( Attribute *a )
 {
@@ -65,22 +59,24 @@ Attribute *attr_dup( Attribute *a )
                }
 
                tmp->a_vals = ch_malloc((i+1) * sizeof(struct berval));
-#ifdef SLAP_NVALUES
-               tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
-#endif
-
                for( i=0; a->a_vals[i].bv_val != NULL; i++ ) {
                        ber_dupbv( &tmp->a_vals[i], &a->a_vals[i] );
                        if( tmp->a_vals[i].bv_val == NULL ) break;
-#ifdef SLAP_NVALUES
-                       ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
-                       if( tmp->a_nvals[i].bv_val == NULL ) break;
-#endif
                }
-
                tmp->a_vals[i].bv_val = NULL;
+
 #ifdef SLAP_NVALUES
-               tmp->a_nvals[i].bv_val = NULL;
+               if( a->a_nvals != NULL ) {
+                       tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
+                       for( i=0; a->a_nvals[i].bv_val != NULL; i++ ) {
+                               ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
+                               if( tmp->a_nvals[i].bv_val == NULL ) break;
+                       }
+                       tmp->a_nvals[i].bv_val = NULL;
+
+               } else {
+                       tmp->a_nvals = NULL;
+               }
 #endif
 
        } else {
@@ -169,7 +165,7 @@ attr_merge_one(
        AttributeDescription *desc,
        struct berval   *val
 #ifdef SLAP_NVALUES
-       , BerVarray     nval
+       , struct berval *nval
 #endif
 ) {
        int rc;