Fix some issues in the test framework found via coverity scan
Fix issues found via coverity scan
Fix issues found via coverity scan
Fix issues found via coverity scan