Fix leaks and warnings

Xcode 4.6 raised some warnings and leaks easy to fix. So I did it.