mirror of
https://github.com/yawut/SDL.git
synced 2026-07-01 00:39:58 -05:00
Fix a memory leak. We need to clean up our autorelease pool code at some point.
This commit is contained in:
parent
298c11033b
commit
63d660e4e0
|
|
@ -235,6 +235,7 @@ Cocoa_GetDisplayName(CGDirectDisplayID displayID)
|
|||
void
|
||||
Cocoa_InitModes(_THIS)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
CGDisplayErr result;
|
||||
CGDirectDisplayID *displays;
|
||||
CGDisplayCount numDisplays;
|
||||
|
|
@ -243,6 +244,7 @@ Cocoa_InitModes(_THIS)
|
|||
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 @@ Cocoa_InitModes(_THIS)
|
|||
if (result != kCGErrorSuccess) {
|
||||
CG_SetError("CGGetOnlineDisplayList()", result);
|
||||
SDL_stack_free(displays);
|
||||
[pool release];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +316,7 @@ Cocoa_InitModes(_THIS)
|
|||
}
|
||||
}
|
||||
SDL_stack_free(displays);
|
||||
[pool release];
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user