Fix some typical SCA issues from cppcheck