more cleanup

This commit is contained in:
Pierangelo Masarati 2005-07-19 15:13:32 +00:00
parent 0f18805d65
commit 551dab0d03
2 changed files with 22 additions and 5 deletions

View file

@ -730,6 +730,11 @@ error_return:;
ch_free( sat );
}
if ( oidm ) {
SLAP_FREE( at->at_oid );
at->at_oid = oidm;
}
} else if ( rsat ) {
*rsat = sat;
}

View file

@ -417,6 +417,8 @@ init_config_attrs(ConfigTable *ct) {
const char *err;
for (i=0; ct[i].name; i++ ) {
int freeit = 0;
if ( !ct[i].attribute ) continue;
at = ldap_str2attributetype( ct[i].attribute,
&code, &err, LDAP_SCHEMA_ALLOW_ALL );
@ -425,19 +427,29 @@ init_config_attrs(ConfigTable *ct) {
ct[i].attribute, ldap_scherr2str(code), err );
return code;
}
code = at_add( at, 0, NULL, &err );
if ( code && code != SLAP_SCHERR_ATTR_DUP ) {
fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
ct[i].attribute, scherr2str(code), err );
return code;
if ( code ) {
if ( code == SLAP_SCHERR_ATTR_DUP ) {
freeit = 1;
} else {
fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s, %s\n",
ct[i].attribute, scherr2str(code), err );
return code;
}
}
code = slap_str2ad( at->at_names[0], &ct[i].ad, &err );
if ( freeit ) {
ldap_attributetype_free( at );
} else {
ldap_memfree( at );
}
if ( code ) {
fprintf( stderr, "init_config_attrs: AttributeType \"%s\": %s\n",
ct[i].attribute, err );
return code;
}
ldap_memfree( at );
}
return 0;