diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 85c334f9c9..ff9425bb57 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -394,6 +394,15 @@ fail:; BER_BVZERO( &rs->sr_ref[ cnt ] ); } + if ( match.bv_val != NULL ) { + if ( match.bv_val[ 0 ] == '\0' ) { + LDAP_FREE( match.bv_val ); + BER_BVZERO( &match ); + } else { + match.bv_len = strlen( match.bv_val ); + } + } + /* cleanup */ if ( references ) { ldap_value_free( references );