if ( a->a_nvals && a->a_nvals != a->a_vals ) {
ber_bvarray_free( a->a_nvals );
}
- ber_bvarray_free( a->a_vals );
+ /* a_vals may be equal to slap_dummy_bv, a static empty berval;
+ * this is used as a placeholder for attributes that do not carry
+ * values, e.g. when proxying search entries with the "attrsonly"
+ * bit set. */
+ if ( a->a_vals != &slap_dummy_bv ) {
+ ber_bvarray_free( a->a_vals );
+ }
free( a );
}
#ifdef LDAP_COMP_MATCH
(*a)->a_comp_data = NULL;
#endif
+ } else {
+ /*
+ * FIXME: if the attribute already exists, the presence
+ * of nvals and the value of (*a)->a_nvals must be consistent
+ */
+ assert( ( nvals == NULL && (*a)->a_nvals == (*a)->a_vals )
+ || ( nvals != NULL && (*a)->a_nvals != (*a)->a_vals ) );
}
rc = value_add( &(*a)->a_vals, vals );