Fix valgrind errors.