Fixed a potential memory leak.