Fix a number of Clang static analyzer warnings.