build: fix valgrind issue