GUAC-852: Use rdpContext.codecs as a basis for determining whether FreeRDP uses _aligned_malloc() internally.

This commit is contained in:
Michael Jumper 2014-11-20 21:41:38 -08:00
parent 98195e606a
commit 7064e12959
2 changed files with 13 additions and 2 deletions

View File

@ -668,7 +668,9 @@ fi
# Check for rdpContext.codecs
if test "x${have_freerdp}" = "xyes"
then
AC_CHECK_MEMBERS([rdpContext.codecs],,,
AC_CHECK_MEMBERS([rdpContext.codecs],
[AC_DEFINE([FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC],,
[Whether this version of FreeRDP requires _aligned_malloc() for bitmap data])],,
[[#include <freerdp/freerdp.h>]])
fi

View File

@ -86,8 +86,13 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
32, ((rdp_freerdp_context*) context)->clrconv);
/* Free existing image, if any */
if (image_buffer != bitmap->data)
if (image_buffer != bitmap->data) {
#ifdef FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC
_aligned_free(bitmap->data);
#else
free(bitmap->data);
#endif
}
/* Store converted image in bitmap */
bitmap->data = image_buffer;
@ -195,7 +200,11 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* d
int size = width * height * 4;
#ifdef FREERDP_BITMAP_REQUIRES_ALIGNED_MALLOC
bitmap->data = (UINT8*) _aligned_malloc(size, 16);
#else
bitmap->data = (UINT8*) malloc(size);
#endif
if (compressed) {