SDL_Surface refcount: fix memory leak when blitting between stack'ed surfaces

(see bug 5226)
This commit is contained in:
Sylvain Becker 2020-10-02 10:48:27 +02:00
parent 883509fc84
commit cd6670bff3
1 changed files with 7 additions and 1 deletions

View File

@ -1259,6 +1259,7 @@ int SDL_ConvertPixels(int width, int height,
SDL_BlitMap src_blitmap, dst_blitmap; SDL_BlitMap src_blitmap, dst_blitmap;
SDL_Rect rect; SDL_Rect rect;
void *nonconst_src = (void *) src; void *nonconst_src = (void *) src;
int ret;
/* Check to make sure we are blitting somewhere, so we don't crash */ /* Check to make sure we are blitting somewhere, so we don't crash */
if (!dst) { if (!dst) {
@ -1311,7 +1312,12 @@ int SDL_ConvertPixels(int width, int height,
rect.y = 0; rect.y = 0;
rect.w = width; rect.w = width;
rect.h = height; rect.h = height;
return SDL_LowerBlit(&src_surface, &rect, &dst_surface, &rect); ret = SDL_LowerBlit(&src_surface, &rect, &dst_surface, &rect);
/* Free blitmap reference, after blitting between stack'ed surfaces */
SDL_InvalidateMap(src_surface.map);
return ret;
} }
/* /*