diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c
index 5fa63bdc2234352127bd2f64e386e4a4ebf042f3..dea9d89f353361535ca3c1bdc841f32be491a41a 100644
--- a/servers/slapd/back-ldbm/filterindex.c
+++ b/servers/slapd/back-ldbm/filterindex.c
@@ -419,6 +419,7 @@ approx_candidates(
 		save = idl;
 		idl = idl_intersection( be, idl, tmp );
 		idl_free( save );
+		idl_free( tmp );
 
 		if( idl == NULL ) break;
 	}
@@ -583,6 +584,7 @@ substring_candidates(
 		save = idl;
 		idl = idl_intersection( be, idl, tmp );
 		idl_free( save );
+		idl_free( tmp );
 
 		if( idl == NULL ) break;
 	}