Memory leak fixes from valgrind analysis