fix previous commit; plug a long lasting leak

This commit is contained in:
Pierangelo Masarati 2005-01-30 23:12:27 +00:00
parent 7d3c997aaf
commit 625263852d

View File

@ -169,7 +169,6 @@ dnssrv_back_search(
send_ldap_error( op, rs, LDAP_SUCCESS, NULL ); send_ldap_error( op, rs, LDAP_SUCCESS, NULL );
} else { } else {
struct berval vals[2];
Entry *e = ch_calloc( 1, sizeof(Entry) ); Entry *e = ch_calloc( 1, sizeof(Entry) );
AttributeDescription *ad_objectClass AttributeDescription *ad_objectClass
= slap_schema.si_ad_objectClass; = slap_schema.si_ad_objectClass;
@ -182,38 +181,33 @@ dnssrv_back_search(
e->e_attrs = NULL; e->e_attrs = NULL;
e->e_private = NULL; e->e_private = NULL;
vals[1].bv_val = NULL; attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_top->soc_cname );
attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname );
BER_BVSTR( &vals[0], "top" ); attr_mergeit_one( e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname );
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_top->soc_cname );
BER_BVSTR( &vals[0], "referral" );
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname );
BER_BVSTR( &vals[0], "extensibleObject" );
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname );
if ( ad_dc ) { if ( ad_dc ) {
char *p; char *p;
vals[0].bv_val = ch_strdup( domain ); struct berval bv;
p = strchr( vals[0].bv_val, '.' ); bv.bv_val = domain;
p = strchr( bv.bv_val, '.' );
if ( p == vals[0].bv_val ) { if ( p == bv.bv_val ) {
vals[0].bv_val[1] = '\0'; bv.bv_len = 1;
} else if ( p != NULL ) { } else if ( p != NULL ) {
*p = '\0'; bv.bv_len = p - bv.bv_val;
} }
vals[0].bv_len = strlen( vals[0].bv_val ); attr_mergeit_one( e, ad_dc, &bv );
attr_mergeit( e, ad_dc, vals );
} }
if ( ad_associatedDomain ) { if ( ad_associatedDomain ) {
vals[0].bv_val = domain; struct berval bv;
vals[0].bv_len = strlen(domain);
attr_mergeit( e, ad_associatedDomain, vals ); ber_str2bv( domain, 0, 0, &bv );
attr_mergeit_one( e, ad_associatedDomain, &bv );
} }
attr_mergeit( e, ad_ref, urls ); attr_mergeit( e, ad_ref, urls );