Refs #9941. Tried to fix some coverity error.
Merge branch 'bugfix/9941_coverity_datahandling' into develop