Fixed a potential memory leak issue.