]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/at.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / at.c
index 54d197c495de09ecf28d556adf0b6aa446d10b01..0ae958094b109c83ca6dd6b68f461f56ce4bf95a 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2008 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -232,6 +232,8 @@ at_delete_names( AttributeType *at )
 {
        char                    **names = at->sat_names;
 
+       if (!names) return;
+
        while (*names) {
                struct aindexrec        tmpair, *air;
 
@@ -939,6 +941,11 @@ error_return:;
                        at->at_oid = oidm;
                }
 
+               if ( soidm ) {
+                       SLAP_FREE( at->at_syntax_oid );
+                       at->at_syntax_oid = soidm;
+               }
+
        } else if ( rsat ) {
                *rsat = sat;
        }
@@ -1075,10 +1082,10 @@ register_at( const char *def, AttributeDescription **rad, int dupok )
                        freeit = 1;
 
                } else {
-                       ldap_attributetype_free( at );
                        Debug( LDAP_DEBUG_ANY,
                                "register_at: AttributeType \"%s\": %s, %s\n",
                                def, scherr2str(code), err );
+                       ldap_attributetype_free( at );
                        return code;
                }
        }