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 2953 - Crash due to a bad cleanup in the SDL_SYS_HapticQuit function
Summary: Crash due to a bad cleanup in the SDL_SYS_HapticQuit function
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: haptic (show other bugs)
Version: 2.0.3
Hardware: All Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-21 07:27 UTC by Mathieu Laurendeau
Modified: 2015-06-15 02:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Laurendeau 2015-04-21 07:27:16 UTC
I think the following lines are missing at the end of the SDL_SYS_HapticQuit function:

numhaptics = 0;
SDL_hapticlist = NULL;
SDL_hapticlist_tail = NULL;

This can result in a use-after-free causing a segmentation fault in the DirectInputHaptic_MaybeAddDevice function in case the Haptic subsystem is reinitialized.
Comment 1 Sam Lantinga 2015-06-15 02:21:38 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/55e88e3bc7cc