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

Summary: fix memory leak: free the 'display' after it was added to global list
Product: SDL Reporter: Christian Rauch <Rauch.Christian>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.15   
Hardware: All   
OS: Linux   
Attachments: free the 'display' after it was added to global list

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