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 - [PATCH] KMSDRM: Make some pointers NULL after freeing them
Summary: [PATCH] KMSDRM: Make some pointers NULL after freeing them
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-01 17:42 UTC by Manuel Alfayate
Modified: 2019-03-11 14:24 UTC (History)
1 user (show)

See Also:


Attachments
KMSDRM patch to set some pointers to NULL after freeing the memory they point to (1.98 KB, patch)
2019-03-01 17:42 UTC, Manuel Alfayate
Details | Diff

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