Fixed some issues/warnings found by clang-analyzer.