Merge Changeset 5838 - MacGUI: fixed a number of leaks/null-deferences/dead-code found by clang static analyzer.