Fix valgrind warnings.