Remove some more cppcheck warnings and a valgrind compile warning