Misc. cleanups

All of these issues were found by clang-3.3's scan-build.