summaryrefslogtreecommitdiffstats
path: root/client/Wayland/wlf_cliprdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/Wayland/wlf_cliprdr.c')
-rw-r--r--client/Wayland/wlf_cliprdr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/client/Wayland/wlf_cliprdr.c b/client/Wayland/wlf_cliprdr.c
index dc189d5..f0c3318 100644
--- a/client/Wayland/wlf_cliprdr.c
+++ b/client/Wayland/wlf_cliprdr.c
@@ -849,6 +849,7 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
ClipboardLock(clipboard->system);
EnterCriticalSection(&clipboard->lock);
+ BYTE* cdata = NULL;
UINT32 srcFormatId = 0;
UINT32 dstFormatId = 0;
switch (request->responseFormat)
@@ -895,14 +896,14 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
const BOOL sres = ClipboardSetData(clipboard->system, srcFormatId, data, size);
if (sres)
- data = ClipboardGetData(clipboard->system, dstFormatId, &len);
+ cdata = ClipboardGetData(clipboard->system, dstFormatId, &len);
- if (!sres || !data)
+ if (!sres || !cdata)
goto unlock;
if (request->responseFile)
{
- const size_t res = fwrite(data, 1, len, request->responseFile);
+ const size_t res = fwrite(cdata, 1, len, request->responseFile);
if (res == len)
rc = CHANNEL_RC_OK;
}
@@ -910,6 +911,7 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
rc = CHANNEL_RC_OK;
unlock:
+ free(cdata);
ClipboardUnlock(clipboard->system);
LeaveCriticalSection(&clipboard->lock);
fail: