Treat warnings as errors and fixed errors with Xcode 5.1.
Fixed clang analyzer warnings, mostly memory leaks.