Fix possible errors discovered by Clang's static analyzer.