Fix release race condition by adding a memory leak