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 2562 - SDL_hapticlist/_tail not set correctly
Summary: SDL_hapticlist/_tail not set correctly
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: haptic (show other bugs)
Version: HG 2.1
Hardware: All Linux
: P2 normal
Assignee: Edgar Simo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-27 05:55 UTC by Zachary L
Modified: 2014-06-22 03:41 UTC (History)
0 users

See Also:


Attachments
Patch containing mentioned fix. (349 bytes, patch)
2014-05-27 05:55 UTC, Zachary L
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zachary L 2014-05-27 05:55:33 UTC
Created attachment 1662 [details]
Patch containing mentioned fix.

SDL_hapticlist and SDL_hapticlist_tail are not set correctly when quitting the subsystem. This matters because they are represented as global variables. In the case you quit and reinitialize the subsystems, problems with dangling pointers arise. 

For instance, SDL_hapticlist_tail will not be null on second initialization and because of the check on line 298, it will fail to set SDL_hapticlist appropriately. This can cause a few things to go wrong, like feeding SDL_strcmp a null fname which can cause a segfault. 

This patch is simple. It just sets SDL_hapticlist and SDL_hapticlist_tail to NULL.
Comment 1 Sam Lantinga 2014-06-22 03:41:18 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/5192470456ae