From a30af8a3219ca7e08bb0a60c9b7e39a1bec918d3 Mon Sep 17 00:00:00 2001 From: RustDesk <71636191+rustdesk@users.noreply.github.com> Date: Sat, 4 Jul 2026 14:54:49 +0800 Subject: [PATCH] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- libs/clipboard/src/windows/wf_cliprdr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/clipboard/src/windows/wf_cliprdr.c b/libs/clipboard/src/windows/wf_cliprdr.c index a3a577a84..7c1448c4a 100644 --- a/libs/clipboard/src/windows/wf_cliprdr.c +++ b/libs/clipboard/src/windows/wf_cliprdr.c @@ -3369,11 +3369,14 @@ wf_cliprdr_server_file_contents_response(CliprdrClientContext *context, // handle closed during teardown) means we do not, so we must not release it. DWORD wait = WaitForSingleObject(clipboard->req_f_mutex, INFINITE); locked = (wait == WAIT_OBJECT_0 || wait == WAIT_ABANDONED); + if (!locked) + { + rc = ERROR_INTERNAL_ERROR; + break; + } // Free any buffer left over from a prior request that was never consumed - // (e.g. a response that arrived after its reader timed out). Safe under the - // lock: a consumer takes ownership of req_fdata under the same mutex, so it - // can never be reading or freeing the buffer we free here. + // (e.g. a response that arrived after its reader timed out). free(clipboard->req_fdata); clipboard->req_fsize = 0; clipboard->req_fdata = NULL;