]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/limits.c
ITS#6242
[openldap] / servers / slapd / limits.c
index 796149c4b3c508cb8ad70804916d2dcc29909bdf..cf22aed463252dbad93f1bf41a5822f42c053b8f 100644 (file)
@@ -1324,6 +1324,19 @@ limits_check( Operation *op, SlapReply *rs )
        return 0;
 }
 
+void
+limits_free_one( 
+       struct slap_limits      *lm )
+{
+       if ( ( lm->lm_flags & SLAP_LIMITS_MASK ) == SLAP_LIMITS_REGEX )
+               regfree( &lm->lm_regex );
+
+       if ( !BER_BVISNULL( &lm->lm_pat ) )
+               ch_free( lm->lm_pat.bv_val );
+
+       ch_free( lm );
+}
+
 void
 limits_destroy( 
        struct slap_limits      **lm )
@@ -1335,13 +1348,7 @@ limits_destroy(
        }
 
        for ( i = 0; lm[ i ]; i++ ) {
-               if ( (lm[ i ]->lm_flags & SLAP_LIMITS_MASK) == SLAP_LIMITS_REGEX )
-                       regfree( &lm[ i ]->lm_regex );
-
-               if ( !BER_BVISNULL( &lm[ i ]->lm_pat ) )
-                       ch_free( lm[ i ]->lm_pat.bv_val );
-
-               ch_free( lm[ i ] );
+               limits_free_one( lm[ i ] );
        }
 
        ch_free( lm );