diff --git a/CHANGES b/CHANGES
index 658c98b8e107fd93e778c644dee8af0dcea3085b..5ff843489191fdd82eddef0c2df43317d9242c91 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ OpenLDAP 2.4.13 Engineering
 	Added slapd PMI schema (ITS#5695)
 	Added slapd private databases in global overlays (ITS#5735,ITS#5736)
 	Fixed slapd slapd.conf validation to LDIF (ITS#5755)
+	Fixed slapd statslog printing of released entry (ITS#5775)
 	Added slapd support for certificateListExactMatch (ITS#5700)
 	Fixed slapd-bdb/hdb invalid db crash (ITS#5698)
 	Added slapd-bdb/hdb dbpagesize keyword
diff --git a/servers/slapd/result.c b/servers/slapd/result.c
index 34b79b4ebf255cf02c3e59395885f6678267c6e6..a2e7343eb6ceca4568d990848114e4a317525405 100644
--- a/servers/slapd/result.c
+++ b/servers/slapd/result.c
@@ -649,14 +649,10 @@ abandon:
 
 	if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
 		if ( op->o_tag == LDAP_REQ_SEARCH ) {
-			char nbuf[64];
-			snprintf( nbuf, sizeof nbuf, "%d nentries=%d",
-				rs->sr_err, rs->sr_nentries );
-
 			Statslog( LDAP_DEBUG_STATS,
-			"%s SEARCH RESULT tag=%lu err=%s text=%s\n",
-				op->o_log_prefix, rs->sr_tag, nbuf,
-				rs->sr_text ? rs->sr_text : "", 0 );
+				"%s SEARCH RESULT tag=%lu err=%d nentries=%d text=%s\n",
+				op->o_log_prefix, rs->sr_tag, rs->sr_err,
+				rs->sr_nentries, rs->sr_text ? rs->sr_text : "" );
 		} else {
 			Statslog( LDAP_DEBUG_STATS,
 				"%s RESULT tag=%lu err=%d text=%s\n",
@@ -747,7 +743,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 	BerElement	*ber = (BerElement *) &berbuf;
 	Attribute	*a;
 	int		i, j, rc = LDAP_UNAVAILABLE, bytes;
-	char		*edn;
 	int		userattrs;
 	AccessControlState acl_state = ACL_STATE_INIT;
 	int			 attrsonly;
@@ -810,8 +805,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 		goto error_return;
 	}
 
-	edn = rs->sr_entry->e_nname.bv_val;
-
 	if ( op->o_res_ber ) {
 		/* read back control or LDAP_CONNECTIONLESS */
 	    ber = op->o_res_ber;
@@ -1198,6 +1191,9 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 		goto error_return;
 	}
 
+	Statslog( LDAP_DEBUG_STATS2, "%s ENTRY dn=\"%s\"\n",
+	    op->o_log_prefix, rs->sr_entry->e_nname.bv_val, 0, 0, 0 );
+
 	if ( rs->sr_flags & REP_ENTRY_MUSTRELEASE ) {
 		be_entry_release_rw( op, rs->sr_entry, 0 );
 		rs->sr_flags ^= REP_ENTRY_MUSTRELEASE;
@@ -1225,9 +1221,6 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 		ldap_pvt_thread_mutex_unlock( &op->o_counters->sc_mutex );
 	}
 
-	Statslog( LDAP_DEBUG_STATS2, "%s ENTRY dn=\"%s\"\n",
-	    op->o_log_prefix, edn, 0, 0, 0 );
-
 	Debug( LDAP_DEBUG_TRACE,
 		"<= send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 );