fixed a potential memory leak in matchmaking logic