1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Fixing memory leak in cocoa_joystick

Making sure that propsRef and valueRef get released no matter when we
break out of the loop.

Resolves #231.
This commit is contained in:
Shane Liesegang 2014-02-06 09:37:37 -08:00 committed by Camilla Berglund
parent a70bcb97bb
commit b4c03b992c

View File

@ -343,6 +343,7 @@ void _glfwInitJoysticks(void)
{
// This device is not relevant to GLFW
CFRelease(valueRef);
CFRelease(propsRef);
continue;
}
@ -360,6 +361,7 @@ void _glfwInitJoysticks(void)
{
// This device is not relevant to GLFW
CFRelease(valueRef);
CFRelease(propsRef);
continue;
}
@ -376,7 +378,11 @@ void _glfwInitJoysticks(void)
&score);
if (kIOReturnSuccess != result)
{
CFRelease(valueRef);
CFRelease(propsRef);
return;
}
plugInResult = (*ppPlugInInterface)->QueryInterface(
ppPlugInInterface,
@ -384,7 +390,11 @@ void _glfwInitJoysticks(void)
(void *) &(joystick->interface));
if (plugInResult != S_OK)
{
CFRelease(valueRef);
CFRelease(propsRef);
return;
}
(*ppPlugInInterface)->Release(ppPlugInInterface);
@ -419,6 +429,7 @@ void _glfwInitJoysticks(void)
(void*) joystick);
CFRelease(valueRef);
}
CFRelease(propsRef);
joystick->axes = calloc(CFArrayGetCount(joystick->axisElements),
sizeof(float));