Fix a memory leak in the check-out logic that prevents opening of
massive repositories.
Ticket [708eab9d48]