Fixed release of get rule objects.

Partial revert of b4c03b992c.

Fixes #262.
This commit is contained in:
Camilla Berglund 2014-05-29 11:28:22 +02:00
parent 0ffe934a3e
commit 8f2336f02c

View File

@ -342,12 +342,9 @@ void _glfwInitJoysticks(void)
if (usagePage != kHIDPage_GenericDesktop) if (usagePage != kHIDPage_GenericDesktop)
{ {
// This device is not relevant to GLFW // This device is not relevant to GLFW
CFRelease(valueRef);
CFRelease(propsRef); CFRelease(propsRef);
continue; continue;
} }
CFRelease(valueRef);
} }
valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey)); valueRef = CFDictionaryGetValue(propsRef, CFSTR(kIOHIDPrimaryUsageKey));
@ -360,12 +357,9 @@ void _glfwInitJoysticks(void)
usage != kHIDUsage_GD_MultiAxisController)) usage != kHIDUsage_GD_MultiAxisController))
{ {
// This device is not relevant to GLFW // This device is not relevant to GLFW
CFRelease(valueRef);
CFRelease(propsRef); CFRelease(propsRef);
continue; continue;
} }
CFRelease(valueRef);
} }
_GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy; _GLFWjoystickIOKit* joystick = _glfw.iokit_js + joy;
@ -379,7 +373,6 @@ void _glfwInitJoysticks(void)
if (kIOReturnSuccess != result) if (kIOReturnSuccess != result)
{ {
CFRelease(valueRef);
CFRelease(propsRef); CFRelease(propsRef);
return; return;
} }
@ -391,7 +384,6 @@ void _glfwInitJoysticks(void)
if (plugInResult != S_OK) if (plugInResult != S_OK)
{ {
CFRelease(valueRef);
CFRelease(propsRef); CFRelease(propsRef);
return; return;
} }
@ -412,7 +404,6 @@ void _glfwInitJoysticks(void)
joystick->name, joystick->name,
sizeof(joystick->name), sizeof(joystick->name),
kCFStringEncodingUTF8); kCFStringEncodingUTF8);
CFRelease(valueRef);
} }
joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL); joystick->axisElements = CFArrayCreateMutable(NULL, 0, NULL);
@ -427,8 +418,8 @@ void _glfwInitJoysticks(void)
range, range,
getElementsCFArrayHandler, getElementsCFArrayHandler,
(void*) joystick); (void*) joystick);
CFRelease(valueRef);
} }
CFRelease(propsRef); CFRelease(propsRef);
joystick->axes = calloc(CFArrayGetCount(joystick->axisElements), joystick->axes = calloc(CFArrayGetCount(joystick->axisElements),