return( an );
reterr:
- for ( i = 0; an[i].an_name.bv_val; i++ ) {
- free( an[i].an_name.bv_val );
- }
- free( an );
+ anlist_free( an, 1, NULL );
+
/*
* overwrites input string
* on error!
return NULL;
}
+void
+anlist_free( AttributeName *an, int freename, void *ctx )
+{
+ if ( an == NULL ) {
+ return;
+ }
+
+ if ( freename ) {
+ int i;
+
+ for ( i = 0; an[i].an_name.bv_val; i++ ) {
+ ber_memfree_x( an[i].an_name.bv_val, ctx );
+ }
+ }
+
+ ber_memfree_x( an, ctx );
+}
+
char **anlist2charray_x( AttributeName *an, int dup, void *ctx )
{
char **attrs;
LDAP_SLAPD_F (AttributeName *) str2anlist LDAP_P(( AttributeName *an,
char *str, const char *brkstr ));
+LDAP_SLAPD_F (void) anlist_free LDAP_P(( AttributeName *an,
+ int freename, void *ctx ));
+
LDAP_SLAPD_F (char **) anlist2charray_x LDAP_P((
AttributeName *an, int dup, void *ctx ));
LDAP_SLAPD_F (char **) anlist2charray LDAP_P(( AttributeName *an, int dup ));