From 551dab0d03c0dbd6d999d21e0baed5b926de50ce Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 19 Jul 2005 15:13:32 +0000 Subject: [PATCH] more cleanup --- servers/slapd/at.c | 5 +++++ servers/slapd/config.c | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index cc4e5ed725..44ec64c2e0 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -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; } diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 013c1a76b8..992ae80809 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -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; -- 2.39.5