We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4986

Summary: [patch] Memory leak in HIDAPI_JoystickConnected
Product: SDL Reporter: Mathieu Eyraud <meyraud705>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: fix leak + memmove

Description Mathieu Eyraud 2020-02-14 14:13:46 UTC
Created attachment 4217 [details]
fix leak + memmove

Memory allocated for device->joysticks on line 589 of SDL_hidapijoystick.c is never freed.

Also, use memmove because memory is overlapping.
Comment 1 Sam Lantinga 2020-02-15 00:16:04 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/30bc6f3e1ec6