]> git.sur5r.net Git - openldap/commitdiff
add helper
authorPierangelo Masarati <ando@openldap.org>
Wed, 5 Feb 2003 22:06:22 +0000 (22:06 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 5 Feb 2003 22:06:22 +0000 (22:06 +0000)
servers/slapd/cr.c

index f8a79a2bf375961ef98ff5c8e64119606e5750ac..1db37ee4fbe229d28cca094dcfd4808fab89cec5 100644 (file)
@@ -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 );
        }
 }