Some small fixes for issues reported by Coverity
Merge branch 'garth/coverity-fixes' into next