| Summary: | Memory leak in SDL_FreeSurface in default branch | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Andrei Karas <akaras> |
| Component: | video | Assignee: | Brandon Schaefer <brandontschaefer> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | brandontschaefer, sezeroz |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
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 |
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