Fixed memory leak.

No more "definitely lost" memory blocks is reported by valgrind.