From 001b8188e843ad0b1c5e45267a1d713bf5634bd0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 23 Feb 2015 20:24:28 -0800 Subject: [PATCH] GUAC-1095: Free any existing bitmap data prior to overwriting the bitmap data pointer. --- src/protocols/rdp/rdp_bitmap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index ee64c3f7..a3211bf4 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -201,8 +201,17 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* d int size = width * height * 4; #ifdef FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC + /* Free pre-existing data, if any (might be reused) */ + if (bitmap->data != NULL) + _aligned_free(bitmap->data); + + /* Allocate new data */ bitmap->data = (UINT8*) _aligned_malloc(size, 16); #else + /* Free pre-existing data, if any (might be reused) */ + free(bitmap->data); + + /* Allocate new data */ bitmap->data = (UINT8*) malloc(size); #endif