]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/limits.c
ITS#7930 partial fix
[openldap] / servers / slapd / limits.c
index 796149c4b3c508cb8ad70804916d2dcc29909bdf..16510e66413cf48d1c11ec4c6a16172931ce85e4 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2009 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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 );