Fixed a memory leak bug.