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

Summary: Crash due to a bad cleanup in the SDL_SYS_HapticQuit function
Product: SDL Reporter: Mathieu Laurendeau <mat.lau>
Component: hapticAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: philipp.wiesemann
Version: 2.0.3   
Hardware: All   
OS: Windows (All)   

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