Fix valgrind warnings on string growth