Static analysis fix: Fixed leaking Objective-C object.

This commit is contained in:
Ryan C. Gordon 2014-03-20 10:04:23 -04:00
parent bcc2ed09b5
commit 1a2a3e9c8b

View File

@ -25,6 +25,7 @@
#include "SDL_cocoavideo.h" #include "SDL_cocoavideo.h"
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#include "SDL_assert.h"
#if !defined(UsrActivity) && defined(__LP64__) && !defined(__POWER__) #if !defined(UsrActivity) && defined(__LP64__) && !defined(__POWER__)
/* /*
@ -266,6 +267,7 @@ Cocoa_RegisterApp(void)
pool = [[NSAutoreleasePool alloc] init]; pool = [[NSAutoreleasePool alloc] init];
if (NSApp == nil) { if (NSApp == nil) {
[SDLApplication sharedApplication]; [SDLApplication sharedApplication];
SDL_assert(NSApp != nil);
if ([NSApp mainMenu] == nil) { if ([NSApp mainMenu] == nil) {
CreateApplicationMenus(); CreateApplicationMenus();
@ -276,7 +278,7 @@ Cocoa_RegisterApp(void)
[NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled",
nil]; nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
[appDefaults release];
} }
if (NSApp && !appDelegate) { if (NSApp && !appDelegate) {
appDelegate = [[SDLAppDelegate alloc] init]; appDelegate = [[SDLAppDelegate alloc] init];