diff --git a/CHANGES b/CHANGES
index 6bc51b11857f162dc9d12442ba67b8996e27e5b9..2945ff5cb2447129dedf05848f4a7e646ee8b197 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,7 @@ OpenLDAP 2.2.28 Engineering
 	Fixed back-bdb/hdb - check for BDB TXN patch
 	Fixed back-hdb nested modrdn bug (ITS#3857)
 	Fixed back-ldap/meta undefined filter propagation (ITS#3785)
-	Fixed back-ldap memory leak (ITS#3862)
+	Fixed back-ldap/meta memory leak (ITS#3862)
 	Fixed back-meta add w/o parent add (ITS#3804)
 	Fixed back-meta control propagation bug (ITS#3813)
 	Fixed syncrepl SASL bind crash (ITS#3792)
diff --git a/servers/slapd/back-meta/init.c b/servers/slapd/back-meta/init.c
index cdb86735f978c3ec715e7a17c982861f6075d0f5..b5043cc97b2f15024500f19a081021570eca362f 100644
--- a/servers/slapd/back-meta/init.c
+++ b/servers/slapd/back-meta/init.c
@@ -222,9 +222,19 @@ meta_back_db_destroy(
 
 		ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
 		ldap_pvt_thread_mutex_destroy( &li->conn_mutex );
+
+		if ( li->rwinfo ) {
+#if 0
+			/* FIXME: needs work */
+			(void)rewrite_info_delete( li->rwinfo );
+#endif
+		}
+
+		free( li );
+
+		be->be_private = NULL;
 	}
 
-	free( be->be_private );
 	return 0;
 }
 
diff --git a/servers/slapd/back-meta/unbind.c b/servers/slapd/back-meta/unbind.c
index 15268dc6f7cbd66d208db18125a2386dad84ca91..8f2839a0e0d876618cf5dcb96173b35224986406 100644
--- a/servers/slapd/back-meta/unbind.c
+++ b/servers/slapd/back-meta/unbind.c
@@ -39,6 +39,8 @@ meta_back_conn_destroy(
 {
 	struct metainfo	*li = ( struct metainfo * )be->be_private;
 	struct metaconn *lc, lc_curr;
+	int		i;
+		
 
 #ifdef NEW_LOGGING
 	LDAP_LOG( BACK_META, ENTRY,
@@ -56,9 +58,14 @@ meta_back_conn_destroy(
 			meta_back_conn_cmp );
 	ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
 
+	/*
+	 * Cleanup rewrite session
+	 */
+	for ( i = 0; i < li->ntargets; ++i ) {
+		rewrite_session_delete( li->targets[ i ]->rwmap.rwm_rw, conn );
+	}
+
 	if ( lc ) {
-		int i;
-		
 #ifdef NEW_LOGGING
 		LDAP_LOG( BACK_META, INFO,
 			"meta_back_conn_destroy: destroying conn %ld\n",
@@ -77,7 +84,6 @@ meta_back_conn_destroy(
 				continue;
 			}
 
-			rewrite_session_delete( li->targets[ i ]->rwmap.rwm_rw, conn );
 			meta_clear_one_candidate( &lc->conns[ i ], 1 );
 		}