return 0;
}
+void ad_destroy( void *in )
+{
+ AttributeDescription *ad = in, *n;
+
+ for (;ad;ad = n) {
+ n = ad->ad_next;
+ ldap_memfree(ad);
+ }
+}
+
int slap_str2ad(
const char *str,
AttributeDescription **ad,
return -1;
}
+void
+at_destroy( void )
+{
+ AttributeType *a, *n;
+ avl_free(attr_index, ldap_memfree);
+
+ for (a=attr_list; a; a=n) {
+ n = a->sat_next;
+ ldap_memfree(a->sat_subtypes);
+ ad_destroy(a->sat_ad);
+ ldap_attributetype_free((LDAPAttributeType *)a);
+ }
+}
+
static int
at_insert(
AttributeType *sat,
while ( *names ) {
air = (struct aindexrec *)
ch_calloc( 1, sizeof(struct aindexrec) );
- air->air_name = ch_strdup(*names);
+ air->air_name = *names;
air->air_at = sat;
if ( avl_insert( &attr_index, (caddr_t) air,
(AVL_CMP) attr_index_cmp,
(AVL_DUP) avl_dup_error ) ) {
*err = *names;
- ldap_memfree(air->air_name);
ldap_memfree(air);
return SLAP_SCHERR_DUP_ATTR;
}
#endif
slapd_daemon_destroy();
+ schema_destroy();
+
#ifdef HAVE_TLS
ldap_pvt_tls_destroy();
#endif
return( NULL );
}
+void
+mr_destroy( void )
+{
+ MatchingRule *m, *n;
+
+ avl_free(mr_index, ldap_memfree);
+ for (m=mr_list; m; m=n) {
+ n = m->smr_next;
+ ldap_matchingrule_free((LDAPMatchingRule *)m);
+ }
+}
+
static int
mr_insert(
MatchingRule *smr,
while ( *names ) {
mir = (struct mindexrec *)
ch_calloc( 1, sizeof(struct mindexrec) );
- mir->mir_name = ch_strdup(*names);
+ mir->mir_name = *names;
mir->mir_mr = smr;
if ( avl_insert( &mr_index, (caddr_t) mir,
(AVL_CMP) mr_index_cmp,
return 0;
}
+void
+oc_destroy( void )
+{
+ ObjectClass *o, *n;
+
+ avl_free(oc_index, ldap_memfree);
+ for (o=oc_list; o; o=n)
+ {
+ n = o->soc_next;
+ ldap_memfree(o->soc_sups);
+ ldap_memfree(o->soc_required);
+ ldap_memfree(o->soc_allowed);
+ ldap_objectclass_free((LDAPObjectClass *)o);
+ }
+}
+
static int
oc_insert(
ObjectClass *soc,
(AVL_DUP) avl_dup_error ) )
{
*err = soc->soc_oid;
- ldap_memfree(oir->oir_name);
ldap_memfree(oir);
return SLAP_SCHERR_DUP_CLASS;
}
while ( *names ) {
oir = (struct oindexrec *)
ch_calloc( 1, sizeof(struct oindexrec) );
- oir->oir_name = ch_strdup(*names);
+ oir->oir_name = *names;
oir->oir_oc = soc;
assert( oir->oir_name );
(AVL_DUP) avl_dup_error ) )
{
*err = *names;
- ldap_memfree(oir->oir_name);
ldap_memfree(oir);
return SLAP_SCHERR_DUP_CLASS;
}
* schema.c
*/
+LDAP_SLAPD_F (void) oc_destroy LDAP_P(( void ));
+LDAP_SLAPD_F (void) at_destroy LDAP_P(( void ));
+LDAP_SLAPD_F (void) ad_destroy LDAP_P(( void * ));
+LDAP_SLAPD_F (void) mr_destroy LDAP_P(( void ));
+LDAP_SLAPD_F (void) syn_destroy LDAP_P(( void ));
+LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
+
LDAP_SLAPD_F (ObjectClass *) oc_find LDAP_P((
const char *ocname));
schema_init_done = 1;
return LDAP_SUCCESS;
}
+
+void
+schema_destroy( void )
+{
+ oc_destroy();
+ at_destroy();
+ mr_destroy();
+ syn_destroy();
+}
struct slap_attr_desc;
typedef struct slap_attribute_type {
- char *sat_cname;
LDAPAttributeType sat_atype;
+ char *sat_cname;
struct slap_attribute_type *sat_sup;
struct slap_attribute_type **sat_subtypes;
MatchingRule *sat_equality;
return( NULL );
}
+void
+syn_destroy( void )
+{
+ Syntax *s, *n;
+
+ avl_free(syn_index, ldap_memfree);
+ for (s=syn_list; s; s=n) {
+ n = s->ssyn_next;
+ ldap_syntax_free((LDAPSyntax *)s);
+ }
+}
+
static int
syn_insert(
Syntax *ssyn,