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 5536 - fix memory leak: free the 'display' after it was added to global list
Summary: fix memory leak: free the 'display' after it was added to global list
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.15
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-08 22:36 UTC by Christian Rauch
Modified: 2021-02-09 00:02 UTC (History)
0 users

See Also:


Attachments
free the 'display' after it was added to global list (870 bytes, patch)
2021-02-08 22:36 UTC, Christian Rauch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Rauch 2021-02-08 22:36:48 UTC
Created attachment 4781 [details]
free the 'display' after it was added to global list

The patch in https://bugzilla.libsdl.org/show_bug.cgi?id=5525 produces a memory leak:

Direct leak of 104 byte(s) in 1 object(s) allocated from:
#0 0x7f371efaf9d1 in malloc (/usr/lib/x86_64-linux-gnu/liblsan.so.0+0xf9d1)
#1 0x55e4c3fc5870 in SDL_malloc_REAL [...]/SDL/src/stdlib/SDL_malloc.c:5387
#2 0x55e4c418d0cc in Wayland_add_display ...]/SDL/src/video/wayland/SDL_waylandvideo.c:323
#3 0x55e4c418d49c in display_handle_global ...]/SDL/src/video/wayland/SDL_waylandvideo.c:398
#4 0x7f371f89aff4  (/usr/lib/x86_64-linux-gnu/libffi.so.7+0x6ff4)


The issue was first reported at https://bugzilla.libsdl.org/show_bug.cgi?id=5525#c3. This was probably overlooked, so I am posting this here again as a dedicated issue.
Comment 1 Sam Lantinga 2021-02-09 00:02:11 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/852a7bdbdf4b