mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-30 01:38:45 +00:00
Fix potential memory leak in SDL_HIDAPI_HapticOpenFromJoystick() on error
This commit is contained in:
parent
2d9fca46c6
commit
6cf03ca729
1 changed files with 1 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue