From 1b499a7d7c4c36fb467562ac60b602764c1e9352 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 5 Feb 2003 22:06:22 +0000 Subject: [PATCH] add helper --- servers/slapd/cr.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 ); } } -- 2.39.5