src/video/cocoa/SDL_cocoamodes.m
changeset 6809 54cca01b6006
parent 6788 036f53f2f5aa
child 6836 b0ca1571caf3
--- a/src/video/cocoa/SDL_cocoamodes.m	Fri Jan 11 20:36:39 2013 -0800
+++ b/src/video/cocoa/SDL_cocoamodes.m	Sat Jan 12 14:04:51 2013 -0500
@@ -235,6 +235,7 @@
 void
 Cocoa_InitModes(_THIS)
 {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     CGDisplayErr result;
     CGDirectDisplayID *displays;
     CGDisplayCount numDisplays;
@@ -243,6 +244,7 @@
     result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
     if (result != kCGErrorSuccess) {
         CG_SetError("CGGetOnlineDisplayList()", result);
+        [pool release];
         return;
     }
     displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
@@ -250,6 +252,7 @@
     if (result != kCGErrorSuccess) {
         CG_SetError("CGGetOnlineDisplayList()", result);
         SDL_stack_free(displays);
+        [pool release];
         return;
     }
 
@@ -313,6 +316,7 @@
         }
     }
     SDL_stack_free(displays);
+    [pool release];
 }
 
 int