libfreerdp-cache: fix leak with child bitmap reuse
This commit is contained in:
parent
12705d36e5
commit
76a943d577
@ -81,11 +81,13 @@ void update_gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap_update)
|
||||
rdpBitmap* bitmap;
|
||||
BITMAP_DATA* bitmap_data;
|
||||
rdpCache* cache = update->context->cache;
|
||||
int reused = 1;
|
||||
|
||||
if (cache->bitmap->bitmap == NULL)
|
||||
{
|
||||
cache->bitmap->bitmap = Bitmap_Alloc(update->context);
|
||||
cache->bitmap->bitmap->ephemeral = True;
|
||||
reused = 0;
|
||||
}
|
||||
|
||||
bitmap = cache->bitmap->bitmap;
|
||||
@ -107,6 +109,11 @@ void update_gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap_update)
|
||||
bitmap_data->bitmapDataStream, bitmap_data->width, bitmap_data->height,
|
||||
bitmap_data->bitsPerPixel, bitmap_data->bitmapLength, bitmap_data->compressed);
|
||||
|
||||
if (reused)
|
||||
bitmap->Free(update->context, bitmap);
|
||||
else
|
||||
reused = 1;
|
||||
|
||||
bitmap->New(update->context, bitmap);
|
||||
|
||||
bitmap->Paint(update->context, bitmap);
|
||||
|
Loading…
Reference in New Issue
Block a user