Fix the memory leak.