Fix a few minor bugs found by the Clang Analyzer.