From 2736d28064437a470897bb9cb8688e354bb93908 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 14 May 2012 18:24:19 +0200 Subject: [PATCH] ole32: Add a NULL pointer check in CoDisconnectObject. --- dlls/ole32/compobj.c | 2 ++ dlls/ole32/tests/marshal.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 72ba32ac6be..ff8f9610c6e 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1557,6 +1557,8 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved ) TRACE("(%p, 0x%08x)\n", lpUnk, reserved); + if (!lpUnk) return E_INVALIDARG; + hr = IUnknown_QueryInterface(lpUnk, &IID_IMarshal, (void **)&marshal); if (hr == S_OK) { diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index c1789125831..91de43b2672 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -1331,6 +1331,9 @@ static void test_disconnect_stub(void) CoDisconnectObject((IUnknown*)&Test_ClassFactory, 0); ok_no_locks(); + + hr = CoDisconnectObject(NULL, 0); + ok( hr == E_INVALIDARG, "wrong status %x\n", hr ); } /* tests failure case of a same-thread marshal and unmarshal twice */ -- 2.11.4.GIT