From: Pierangelo Masarati Date: Wed, 5 Feb 2003 22:06:22 +0000 (+0000) Subject: add helper X-Git-Tag: NO_SLAP_OP_BLOCKS~426 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1b499a7d7c4c36fb467562ac60b602764c1e9352;p=openldap add helper --- diff --git a/servers/slapd/cr.c b/servers/slapd/cr.c index f8a79a2bf3..1db37ee4fb 100644 --- a/servers/slapd/cr.c +++ b/servers/slapd/cr.c @@ -78,6 +78,20 @@ cr_bvfind( struct berval *crname ) return( NULL ); } +static int +cr_destroy_one( ContentRule *c ) +{ + assert( c != NULL ); + + if (c->scr_auxiliaries) ldap_memfree(c->scr_auxiliaries); + if (c->scr_required) ldap_memfree(c->scr_required); + if (c->scr_allowed) ldap_memfree(c->scr_allowed); + if (c->scr_precluded) ldap_memfree(c->scr_precluded); + ldap_contentrule_free((LDAPContentRule *)c); + + return 0; +} + void cr_destroy( void ) { @@ -89,11 +103,7 @@ cr_destroy( void ) c = LDAP_SLIST_FIRST(&cr_list); LDAP_SLIST_REMOVE_HEAD(&cr_list, scr_next); - if (c->scr_auxiliaries) ldap_memfree(c->scr_auxiliaries); - if (c->scr_required) ldap_memfree(c->scr_required); - if (c->scr_allowed) ldap_memfree(c->scr_allowed); - if (c->scr_precluded) ldap_memfree(c->scr_precluded); - ldap_contentrule_free((LDAPContentRule *)c); + cr_destroy_one( c ); } }