From b87fc5d0f98ef4e499d437b94397c4a6d8a54ba5 Mon Sep 17 00:00:00 2001 From: Peter Hull Date: Sat, 24 Feb 2024 13:28:07 +0000 Subject: [PATCH] Free allocated memory during joystick initialization --- src/macosx/hidjoy.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macosx/hidjoy.m b/src/macosx/hidjoy.m index d14737ca3..fce924aa4 100644 --- a/src/macosx/hidjoy.m +++ b/src/macosx/hidjoy.m @@ -362,7 +362,7 @@ static int enumerate_and_create_initial_joystick_devices(IOHIDManagerRef manager else { CFIndex num_devices = CFSetGetCount(devices); - IOHIDDeviceRef *device_arr = calloc(num_devices, sizeof(IOHIDDeviceRef)); + IOHIDDeviceRef *device_arr = al_calloc(num_devices, sizeof(IOHIDDeviceRef)); CFSetGetValues(devices, (const void **) device_arr); for (i = 0; i < num_devices; i++) { @@ -370,7 +370,7 @@ static int enumerate_and_create_initial_joystick_devices(IOHIDManagerRef manager add_joystick_device(dev, false); num_joysticks_enumerated++; } - + al_free(device_arr); CFRelease(devices); }