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 - [patch] Memory leak in HIDAPI_JoystickConnected
Summary: [patch] Memory leak in HIDAPI_JoystickConnected
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-14 14:13 UTC by Mathieu Eyraud
Modified: 2020-02-15 00:16 UTC (History)
0 users

See Also:


Attachments
fix leak + memmove (837 bytes, patch)
2020-02-14 14:13 UTC, Mathieu Eyraud
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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