Fix memory leak.

Found by cppcheck.