Fix clang warnings & memory leaks

A couple of fixes for issues found using `Product > Analyze` in Xcode 5.0.2