ole32: Zero output interface pointer in OleGetClipboard() on error.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2016-01-15 15:09:54 +03:00 committed by Alexandre Julliard
parent b4b0c138fe
commit 5d4b23e6e7
2 changed files with 21 additions and 0 deletions

View File

@ -2201,6 +2201,7 @@ HRESULT WINAPI OleGetClipboard(IDataObject **obj)
TRACE("(%p)\n", obj);
if(!obj) return E_INVALIDARG;
*obj = NULL;
if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;

View File

@ -1571,6 +1571,25 @@ static void test_multithreaded_clipboard(void)
OleUninitialize();
}
static void test_get_clipboard_locked(void)
{
HRESULT hr;
IDataObject *pDObj;
OleInitialize(NULL);
pDObj = (IDataObject *)0xdeadbeef;
/* lock clipboard */
OpenClipboard(NULL);
hr = OleGetClipboard(&pDObj);
todo_wine ok(hr == CLIPBRD_E_CANT_OPEN, "OleGetClipboard() got 0x%08x instead of 0x%08x\n", hr, CLIPBRD_E_CANT_OPEN);
todo_wine ok(pDObj == NULL, "OleGetClipboard() got 0x%p instead of NULL\n",pDObj);
if (pDObj) IDataObject_Release(pDObj);
CloseClipboard();
OleUninitialize();
}
START_TEST(clipboard)
{
test_set_clipboard();
@ -1579,4 +1598,5 @@ START_TEST(clipboard)
test_nonole_clipboard();
test_getdatahere();
test_multithreaded_clipboard();
test_get_clipboard_locked();
}