Fixed two more memory errors using Valgrind.