Fix clang static analyzer warnings with cocoa platform.