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 4529

Summary: [PATCH] KMSDRM: Make some pointers NULL after freeing them
Product: SDL Reporter: Manuel Alfayate <redwindwanderer2>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sylvain.becker
Version: HG 2.1   
Hardware: All   
OS: Linux   
Attachments: KMSDRM patch to set some pointers to NULL after freeing the memory they point to

Description Manuel Alfayate 2019-03-01 17:42:01 UTC
Created attachment 3684 [details]
KMSDRM patch to set some pointers to NULL after freeing the memory they point to

Hi,

I'm sending this patch that does two things:
1 - Makes some pointers NULL after being freed manually via SDL_free. This is important because, for example, in KMSDRM_FreeCursor() we are freeing cursor->driverdata, and in KMSDRM_WarpMouseGlobal() we are testing the condition mouse->cur_cursor->driverdata != NULL, so the pointer needs not only to be freed but ALSO nullified.

2 - It changes some free() calls in the kmsdrm code to SDL_free() calls, as they should be.

Please merge, thanks!
Comment 1 Sylvain 2019-03-11 14:24:40 UTC
Thanks, 
Fixed in https://hg.libsdl.org/SDL/rev/f65980cb112f

Only the part 2/ 
KMSDRM: change calls free() to SDL_free() (Bug 4529)

The 1/ variables are local, it's unnecessary to make them NULL