Fix a memory leak. We need to clean up our autorelease pool code at some point.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 12 Jan 2013 14:04:51 -0500
changeset 680954cca01b6006
parent 6808 3ad413bd1cd6
child 6810 b5609445aa4c
Fix a memory leak. We need to clean up our autorelease pool code at some point.
src/video/cocoa/SDL_cocoamodes.m
     1.1 --- a/src/video/cocoa/SDL_cocoamodes.m	Fri Jan 11 20:36:39 2013 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoamodes.m	Sat Jan 12 14:04:51 2013 -0500
     1.3 @@ -235,6 +235,7 @@
     1.4  void
     1.5  Cocoa_InitModes(_THIS)
     1.6  {
     1.7 +    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     1.8      CGDisplayErr result;
     1.9      CGDirectDisplayID *displays;
    1.10      CGDisplayCount numDisplays;
    1.11 @@ -243,6 +244,7 @@
    1.12      result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
    1.13      if (result != kCGErrorSuccess) {
    1.14          CG_SetError("CGGetOnlineDisplayList()", result);
    1.15 +        [pool release];
    1.16          return;
    1.17      }
    1.18      displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
    1.19 @@ -250,6 +252,7 @@
    1.20      if (result != kCGErrorSuccess) {
    1.21          CG_SetError("CGGetOnlineDisplayList()", result);
    1.22          SDL_stack_free(displays);
    1.23 +        [pool release];
    1.24          return;
    1.25      }
    1.26  
    1.27 @@ -313,6 +316,7 @@
    1.28          }
    1.29      }
    1.30      SDL_stack_free(displays);
    1.31 +    [pool release];
    1.32  }
    1.33  
    1.34  int