Fix coverity defects

I've run the Tempus code base through the free Coverity scanner, and it found a lot of defects. This fixes roughly 10% of the ones found. I'll be working through the list over time.