Merge pull request #4709 from fufesou/fix/file_clipboard

fix release istream
This commit is contained in:
RustDesk 2023-06-20 22:55:20 +08:00 committed by GitHub
commit 4a51bfe4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -568,10 +568,13 @@ static CliprdrStream *CliprdrStream_New(UINT32 connID, ULONG index, void *pData,
success = TRUE; success = TRUE;
} }
if (clipboard->req_fdata != NULL)
{
instance->m_lSize.QuadPart = *((LONGLONG *)clipboard->req_fdata); instance->m_lSize.QuadPart = *((LONGLONG *)clipboard->req_fdata);
free(clipboard->req_fdata); free(clipboard->req_fdata);
clipboard->req_fdata = NULL; clipboard->req_fdata = NULL;
} }
}
else else
success = TRUE; success = TRUE;
} }
@ -1544,7 +1547,7 @@ UINT cliprdr_send_request_filecontents(wfClipboard *clipboard, UINT32 connID, co
return rc; return rc;
} }
return wait_response_event(clipboard, clipboard->req_fevent, (void**)&clipboard->req_fdata); return wait_response_event(clipboard, clipboard->req_fevent, (void **)&clipboard->req_fdata);
} }
static UINT cliprdr_send_response_filecontents( static UINT cliprdr_send_response_filecontents(
@ -2793,6 +2796,13 @@ exit:
if (pDataObj) if (pDataObj)
IDataObject_Release(pDataObj); IDataObject_Release(pDataObj);
// https://learn.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-idataobject-getdata#:~:text=value%20of%20its-,pUnkForRelease,-member.%20If%20pUnkForRelease
if (pStreamStc && vStgMedium.pUnkForRelease == NULL)
{
IStream_Release(pStreamStc);
pStreamStc = NULL;
}
if (rc != CHANNEL_RC_OK) if (rc != CHANNEL_RC_OK)
{ {
uSize = 0; uSize = 0;