Fix leaks and warnings reported by valgrind.
5 files changed