GUACAMOLE-1181: Only free wStream after send if FreeRDP requires this.

This commit is contained in:
Michael Jumper 2020-10-29 11:59:13 -07:00
parent 2c86e20ab9
commit 256487c95a
2 changed files with 26 additions and 1 deletions

View File

@ -623,7 +623,7 @@ then
fi
# Variation in memory internal allocation/free behavior
# Variation in memory internal allocation/free behavior for bitmaps
if test "x${have_freerdp2}" = "xyes"
then
@ -647,6 +647,29 @@ then
fi
# Variation in memory internal allocation/free behavior for channel streams
if test "x${have_freerdp2}" = "xyes"
then
# FreeRDP 2.0.0-rc3 through 2.0.0-rc4 automatically free the wStream
# provided to pVirtualChannelWriteEx(). This changed in commit 1b78b59, and
# implementations must manually free the wStream after it is no longer
# needed (after the write is complete or cancelled).
AC_MSG_CHECKING([whether pVirtualChannelWriteEx() frees the wStream upon completion])
AC_EGREP_CPP([\"2\\.0\\.0-(rc|dev)[3-4]\"], [
#include <freerdp/version.h>
FREERDP_VERSION_FULL
],
[AC_MSG_RESULT([yes])]
[AC_DEFINE([FREERDP_SVC_CORE_FREES_WSTREAM],,
[Whether pVirtualChannelWriteEx() frees the wStream upon completion])],
[AC_MSG_RESULT([no])])
fi
# Glyph callback variants
if test "x${have_freerdp2}" = "xyes"
then

View File

@ -81,12 +81,14 @@ static VOID guac_rdp_common_svc_handle_open_event(LPVOID user_param,
DWORD open_handle, UINT event, LPVOID data, UINT32 data_length,
UINT32 total_length, UINT32 data_flags) {
#ifndef FREERDP_SVC_CORE_FREES_WSTREAM
/* Free stream data after send is complete */
if ((event == CHANNEL_EVENT_WRITE_CANCELLED
|| event == CHANNEL_EVENT_WRITE_COMPLETE) && data != NULL) {
Stream_Free((wStream*) data, TRUE);
return;
}
#endif
/* Ignore all events except for received data */
if (event != CHANNEL_EVENT_DATA_RECEIVED)