Damjan Jovanovic : winex11: Fix a WM_DROPFILES memory ownership ambiguity.
Alexandre Julliard
julliard at winehq.org
Tue May 6 13:37:12 CDT 2014
Module: wine
Branch: master
Commit: f0a91c0248d8e584e1095dc2308657c6b7a51a6f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f0a91c0248d8e584e1095dc2308657c6b7a51a6f
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Tue May 6 03:02:45 2014 +0200
winex11: Fix a WM_DROPFILES memory ownership ambiguity.
---
dlls/winex11.drv/xdnd.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 5d37495..dbe87e8 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -727,17 +727,20 @@ static void X11DRV_XDND_SendDropFiles(HWND hwnd)
if (found)
{
- DROPFILES *lpDrop = current->data;
+ HGLOBAL dropHandle = GlobalAlloc(GMEM_FIXED, current->size);
- if (lpDrop)
+ if (dropHandle)
{
+ DROPFILES *lpDrop = GlobalLock(dropHandle);
lpDrop->pt.x = XDNDxy.x;
lpDrop->pt.y = XDNDxy.y;
-
+ memcpy(lpDrop, current->data, current->size);
TRACE("Sending WM_DROPFILES: hWnd(0x%p) %p(%s)\n", hwnd,
((char*)lpDrop) + lpDrop->pFiles, debugstr_w((WCHAR*)(((char*)lpDrop) + lpDrop->pFiles)));
+ GlobalUnlock(dropHandle);
- PostMessageW(hwnd, WM_DROPFILES, (WPARAM)lpDrop, 0L);
+ if (!PostMessageW(hwnd, WM_DROPFILES, (WPARAM)dropHandle, 0))
+ GlobalFree(dropHandle);
}
}
@@ -761,6 +764,7 @@ static void X11DRV_XDND_FreeDragDropOp(void)
LIST_FOR_EACH_ENTRY_SAFE(current, next, &xdndData, XDNDDATA, entry)
{
list_remove(¤t->entry);
+ HeapFree(GetProcessHeap(), 0, current->data);
HeapFree(GetProcessHeap(), 0, current);
}
More information about the wine-cvs
mailing list