Fixed drdynvc_send stream release

(cherry picked from commit a497e78d37)
This commit is contained in:
akallabeth 2020-05-12 16:34:01 +02:00
parent 3fe4650b2c
commit a84d2783f9

View File

@ -615,7 +615,6 @@ static UINT dvcman_close_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32
Stream_Write_UINT8(s, (CLOSE_REQUEST_PDU << 4) | 0x02); Stream_Write_UINT8(s, (CLOSE_REQUEST_PDU << 4) | 0x02);
Stream_Write_UINT32(s, ChannelId); Stream_Write_UINT32(s, ChannelId);
error = drdynvc_send(drdynvc, s); error = drdynvc_send(drdynvc, s);
Stream_Release(s);
} }
} }
@ -758,17 +757,19 @@ static UINT drdynvc_send(drdynvcPlugin* drdynvc, wStream* s)
switch (status) switch (status)
{ {
case CHANNEL_RC_OK: case CHANNEL_RC_OK:
Stream_AddRef(s);
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
case CHANNEL_RC_NOT_CONNECTED: case CHANNEL_RC_NOT_CONNECTED:
Stream_Release(s);
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
case CHANNEL_RC_BAD_CHANNEL_HANDLE: case CHANNEL_RC_BAD_CHANNEL_HANDLE:
Stream_Release(s);
WLog_ERR(TAG, "VirtualChannelWriteEx failed with CHANNEL_RC_BAD_CHANNEL_HANDLE"); WLog_ERR(TAG, "VirtualChannelWriteEx failed with CHANNEL_RC_BAD_CHANNEL_HANDLE");
return status; return status;
default: default:
Stream_Release(s);
WLog_Print(drdynvc->log, WLOG_ERROR, WLog_Print(drdynvc->log, WLOG_ERROR,
"VirtualChannelWriteEx failed with %s [%08" PRIX32 "]", "VirtualChannelWriteEx failed with %s [%08" PRIX32 "]",
WTSErrorToString(status), status); WTSErrorToString(status), status);
@ -814,6 +815,7 @@ static UINT drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, const B
if (dataSize == 0) if (dataSize == 0)
{ {
dvcman_close_channel(drdynvc->channel_mgr, ChannelId, TRUE); dvcman_close_channel(drdynvc->channel_mgr, ChannelId, TRUE);
Stream_Release(data_out);
} }
else if (dataSize <= CHANNEL_CHUNK_LENGTH - pos) else if (dataSize <= CHANNEL_CHUNK_LENGTH - pos)
{ {