[cppcheck] fix some nits turned up by cppcheck