]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Fix for dn2entry NULL result
authorHoward Chu <hyc@openldap.org>
Thu, 25 Aug 2011 10:04:00 +0000 (03:04 -0700)
committerHoward Chu <hyc@openldap.org>
Thu, 25 Aug 2011 10:04:00 +0000 (03:04 -0700)
servers/slapd/back-mdb/delete.c

index 30edd4ec279d4c0fc7487144b94cc0f208e33b64..da6d0665692c513e59d21c8f0745dd3e7c1478c2 100644 (file)
@@ -136,19 +136,19 @@ txnReturn:
                        "<=- " LDAP_XSTRING(mdb_delete) ": no such object %s\n",
                        op->o_req_dn.bv_val, 0, 0);
 
-               if ( !BER_BVISEMPTY( &p->e_name )) {
+               if ( p && !BER_BVISEMPTY( &p->e_name )) {
                        rs->sr_matched = ch_strdup( p->e_name.bv_val );
-                       rs->sr_ref = ( p && is_entry_referral( p ))
+                       rs->sr_ref = ( is_entry_referral( p ))
                                ? get_entry_referrals( op, p )
                                : NULL;
-                       if ( p ) {
-                               mdb_entry_return( p );
-                               p = NULL;
-                       }
                } else {
                        rs->sr_ref = referral_rewrite( default_referral, NULL,
                                        &op->o_req_dn, LDAP_SCOPE_DEFAULT );
                }
+               if ( p ) {
+                       mdb_entry_return( p );
+                       p = NULL;
+               }
 
                rs->sr_err = LDAP_REFERRAL;
                rs->sr_flags = REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED;