Test with Coverity and fix potential errors

The Travis failures are from using my Coverity test quota. I will retest after Thu, 18 Sep 2014 19:40:52 UTC.