Fixed the memory leak.