Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fix a memory leak. We need to clean up our autorelease pool code at s…
Browse files Browse the repository at this point in the history
…ome point.
  • Loading branch information
icculus committed Jan 12, 2013
1 parent 17b1a84 commit 9147ca9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/video/cocoa/SDL_cocoamodes.m
Expand Up @@ -235,6 +235,7 @@ - (void) setFrame:(NSRect)frame;
void
Cocoa_InitModes(_THIS)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGDisplayErr result;
CGDirectDisplayID *displays;
CGDisplayCount numDisplays;
Expand All @@ -243,13 +244,15 @@ - (void) setFrame:(NSRect)frame;
result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
if (result != kCGErrorSuccess) {
CG_SetError("CGGetOnlineDisplayList()", result);
[pool release];
return;
}
displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays);
result = CGGetOnlineDisplayList(numDisplays, displays, &numDisplays);
if (result != kCGErrorSuccess) {
CG_SetError("CGGetOnlineDisplayList()", result);
SDL_stack_free(displays);
[pool release];
return;
}

Expand Down Expand Up @@ -313,6 +316,7 @@ - (void) setFrame:(NSRect)frame;
}
}
SDL_stack_free(displays);
[pool release];
}

int
Expand Down

0 comments on commit 9147ca9

Please sign in to comment.