app: fix valgrind warnings