#include "ldap_pvt.h"
#include "slap.h"
-#ifdef LDAP_DEBUG
-static void at_index_print( void )
-{
-}
-#endif
-
void
attr_free( 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 {
AttributeDescription *desc,
struct berval *val
#ifdef SLAP_NVALUES
- , BerVarray nval
+ , struct berval *nval
#endif
) {
int rc;