ber_bvecadd does.
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
- bvarray_free( ref );
+ if ( ref ) bvarray_free( ref );
goto done;
}
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
- bvarray_free( ref );
+ if ( ref ) bvarray_free( ref );
#endif
}
} else {
return a-1;
}
-void
+/* Unlike charray_add, bvarray_add does not make a new copy of the
+ * source string. Typically it is used where ber_bvecadd was before,
+ * and ber_bvecadd didn't duplicate its source either.
+ */
+int
bvarray_add(
struct berval **a,
struct berval *bv
*a = (struct berval *) ch_realloc( (char *) *a,
(n + 2) * sizeof(struct berval) );
}
+ if ( *a == NULL ) return -1;
- ber_dupbv( (*a)+n, bv );
- n++;
+ (*a)[n++] = *bv;
(*a)[n].bv_val = NULL;
+
+ return 0;
}
void
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
-LDAP_SLAPD_F (void) bvarray_add LDAP_P(( BVarray *a, struct berval *bv ));
+LDAP_SLAPD_F (int) bvarray_add LDAP_P(( BVarray *a, struct berval *bv ));
LDAP_SLAPD_F (void) bvarray_free LDAP_P(( struct berval *a ));
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((