Remove unnecessary clipboard data copy.
@@ -929,36 +929,28 @@ static UINT cliprdr_server_receive_format_data_response(
{
CLIPRDR_FORMAT_DATA_RESPONSE formatDataResponse;
UINT error = CHANNEL_RC_OK;
- BYTE* requestedFormatData = NULL;
+
WLog_DBG(TAG, "CliprdrClientFormatDataResponse");
formatDataResponse.msgType = CB_FORMAT_DATA_RESPONSE;
formatDataResponse.msgFlags = header->msgFlags;
formatDataResponse.dataLen = header->dataLen;
formatDataResponse.requestedFormatData = NULL;
- if (Stream_GetRemainingLength(s) < header->dataLen)
+ if (header->dataLen)
+ formatDataResponse.requestedFormatData = Stream_Pointer(s);
+
+ if (!Stream_SafeSeek(s, header->dataLen))
{
WLog_ERR(TAG, "not enough data in stream!");
return ERROR_INVALID_DATA;
}
- if (header->dataLen)
- {
- requestedFormatData = (BYTE*) malloc(header->dataLen);
- if (!requestedFormatData)
- return ERROR_OUTOFMEMORY;
-
- Stream_Read(s, requestedFormatData, header->dataLen);
- formatDataResponse.requestedFormatData = requestedFormatData;
- }
-
IFCALLRET(context->ClientFormatDataResponse, error, context,
&formatDataResponse);
if (error)
WLog_ERR(TAG, "ClientFormatDataResponse failed with error %"PRIu32"!", error);
- free(requestedFormatData);
return error;
}
