mirror of
https://github.com/yawut/SDL.git
synced 2026-08-20 15:54:10 -05:00
Fix a memory leak. We need to clean up our autorelease pool code at some point.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user