]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-meta/candidates.c
Do not return pointers into BerElement we do not own
[openldap] / servers / slapd / back-meta / candidates.c
index 330f5b87469addd52207e6b2a7c218cc25ff7209..3aaab4d5fbfeac78075bbb1d61ef7f7fc531dcfd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  *
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
@@ -139,7 +139,7 @@ meta_back_count_candidates(
        assert( li->ntargets != 0 );
 
        for ( i = 0; i < li->ntargets; ++i ) {
-               if ( meta_back_is_candidate( li->targets[ i ]->suffix, ndn ) ) {
+               if ( meta_back_is_candidate( &li->targets[ i ]->suffix, ndn ) ) {
                        ++cnt;
                }
        }
@@ -187,7 +187,7 @@ meta_back_select_unique_candidate(
        }
 
        for ( i = 0; i < li->ntargets; ++i ) {
-               if ( meta_back_is_candidate( li->targets[ i ]->suffix, ndn ) ) {
+               if ( meta_back_is_candidate( &li->targets[ i ]->suffix, ndn ) ) {
                        return i;
                }
        }
@@ -214,7 +214,7 @@ meta_clear_unused_candidates(
                if ( i == candidate ) {
                        continue;
                }
-               meta_clear_one_candidate( lc->conns[ i ], reallyclean );
+               meta_clear_one_candidate( &lc->conns[ i ], reallyclean );
        }
 
        return 0;
@@ -242,9 +242,10 @@ meta_clear_one_candidate(
                lsc->ld = NULL;
        }
 
-       if ( lsc->bound_dn != NULL ) {
-               ber_bvfree( lsc->bound_dn );
-               lsc->bound_dn = NULL;
+       if ( lsc->bound_dn.bv_val != NULL ) {
+               ber_memfree( lsc->bound_dn.bv_val );
+               lsc->bound_dn.bv_val = NULL;
+               lsc->bound_dn.bv_len = 0;
        }
 
        return 0;