Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in SDL_FreeSurface in default branch #2640

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Memory leak in SDL_FreeSurface in default branch #2640

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2017-10-02 00:00:10 +0000, Andrei Karas wrote:

Look like in changeset 11551:a09c3f87a12f was introduced memory leak in SDL_FreeSurface. It leaking surface->map pointer.

Part of leak report from asan from gcc 7:
Direct leak of 128 byte(s) in 1 object(s) allocated from:
# 0 0x7fe7b7825468 in __interceptor_calloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cc:70
# 1 0x7fe7b3142507 in SDL_AllocBlitMap /mnt/src/spm/tmp/SDL2/src/video/SDL_pixels.c:966
# 2 0x7fe7b315c437 in SDL_CreateRGBSurfaceWithFormat_REAL /mnt/src/spm/tmp/SDL2/src/video/SDL_surface.c:94
# 3 0x7fe7b3c1d052 in IMG_LoadPNG_RW /mnt/src/spm/tmp/SDL2_image/IMG_png.c:553
# 4 0x7fe7b3be6829 in IMG_LoadTyped_RW /mnt/src/spm/tmp/SDL2_image/IMG.c:198

Now default branch on changeset 11553:b89649d1a7a5

On 2017-10-02 17:52:18 +0000, Brandon Schaefer wrote:

I can confirm as well testing with testdrawchessboard.

Seems to just be missing a SDL_FreeBlitMap in the FreeSurface if its allocated.

==25380== 128 bytes in 1 blocks are definitely lost in loss record 96 of 142
==25380== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25380== by 0x4F01E5F: SDL_AllocBlitMap (SDL_pixels.c:966)
==25380== by 0x4F0719F: SDL_CreateRGBSurfaceWithFormat_REAL (SDL_surface.c:94)
==25380== by 0x4F0719F: SDL_CreateRGBSurface_REAL (SDL_surface.c:127)
==25380== by 0x4F0719F: SDL_CreateRGBSurfaceFrom_REAL (SDL_surface.c:141)
==25380== by 0x4F0B5B1: SDL_CreateWindowFramebuffer (SDL_video.c:2212)
==25380== by 0x4F0B5B1: SDL_GetWindowSurface_REAL (SDL_video.c:2225)
==25380== by 0x108B8F: main (testdrawchessboard.c:121)

Fixed with:
https://hg.libsdl.org/SDL/rev/3a23ca106752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant