mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-09 18:45:35 +00:00
Fix potential memory leak in SDL_HIDAPI_HapticOpenFromJoystick() on error
This commit is contained in:
committed by
Sam Lantinga
parent
2d9fca46c6
commit
6cf03ca729
@@ -147,6 +147,7 @@ bool SDL_HIDAPI_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystic
|
||||
haptic->neffects = device->driver->NumEffects(device);
|
||||
haptic->effects = (struct haptic_effect *)SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
|
||||
if (haptic->effects == NULL) {
|
||||
SDL_free(list_node);
|
||||
device->driver->Close(device);
|
||||
SDL_free(device);
|
||||
return SDL_OutOfMemory();
|
||||
|
||||
Reference in New Issue
Block a user