Commit 5d4b23e6 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

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

parent b4b0c138
......@@ -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;
......
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment