]> git.sur5r.net Git - openldap/commitdiff
more cleanup
authorPierangelo Masarati <ando@openldap.org>
Tue, 19 Jul 2005 15:13:32 +0000 (15:13 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 19 Jul 2005 15:13:32 +0000 (15:13 +0000)
servers/slapd/at.c
servers/slapd/config.c

index cc4e5ed7252a65f6afb0fbae03aa484715834c05..44ec64c2e0499b4ddfea3fa46d0c428e0bb8014e 100644 (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;
        }
index 013c1a76b87bc7decf2562cd82a453f138230d74..992ae80809c715892a8ae4236c4cee3802e93476 100644 (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;