Static analyze fixes

I added a few fixes for static analyser warnings about garbage data getting returned from functions and a leak.

I also did the recommended Xcode project upgrades suggested by Xcode 4.6 - that part is probably less important.

Finally I added a few paths in the .gitignore file for common Xcode project user specific configuration files.