]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/compare.c
Remove duplicate ldap_pvt_thread_rdwr_runlock
[openldap] / servers / slapd / back-ldbm / compare.c
index 7b80428047870103e5f2289b5fdba3b23a54b660..4075766a4b5e7e43fc63450c7f5863675d788c14 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -46,10 +46,7 @@ ldbm_back_compare(
        e = dn2entry_r( op->o_bd, &op->o_req_ndn, &matched );
        if ( e == NULL ) {
                if ( matched != NULL ) {
-                       struct berval   bv;
-
-                       ber_str2bv_x( matched, 0, 1, &bv, op->o_tmpmemctx );
-                       rs->sr_matched = bv.bv_val;
+                       rs->sr_matched = ch_strdup( matched->e_dn );
                        rs->sr_ref = is_entry_referral( matched )
                                ? get_entry_referrals( op, matched )
                                : NULL;
@@ -59,8 +56,6 @@ ldbm_back_compare(
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
 
-               ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
-
                rs->sr_err = LDAP_REFERRAL;
                goto return_results;
        }
@@ -110,7 +105,7 @@ ldbm_back_compare(
        }
 
 return_results:;
-       cache_return_entry_r( &li->li_cache, e );
+       if ( e ) cache_return_entry_r( &li->li_cache, e );
        ldap_pvt_thread_rdwr_runlock(&li->li_giant_rwlock);
 
        send_ldap_result( op, rs );