Coverity fixes

A few issues identified by coverity.
Oh, right. Then it's Coverity's bad reporting system that confused me, the email I got listed only this line as the culprit, but omitted the actual problem.