From a25bd63cc5ba4e1f008283eaa33ac66de276f5de Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 20 Mar 2014 16:05:57 -0400 Subject: [PATCH] Static analysis fix: leaking Objective-C object. --- src/video/cocoa/SDL_cocoaevents.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 1623adb96..9c0d2b2ac 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -159,13 +159,19 @@ CreateApplicationMenus(void) NSMenu *windowMenu; NSMenu *viewMenu; NSMenuItem *menuItem; + NSMenu *mainMenu; if (NSApp == nil) { return; } - + + mainMenu = [[NSMenu alloc] init]; + /* Create the main menu bar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; + [NSApp setMainMenu:mainMenu]; + + [mainMenu release]; /* we're done with it, let NSApp own it. */ + mainMenu = nil; /* Create the application menu */ appName = GetApplicationName();