Fix cppcheck scope error.

Refs #8598