Alexandre Julliard : ole32: Add a NULL pointer check in CoDisconnectObject.

Alexandre Julliard julliard at winehq.org
Mon May 14 14:26:06 CDT 2012


Module: wine
Branch: master
Commit: 2736d28064437a470897bb9cb8688e354bb93908
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2736d28064437a470897bb9cb8688e354bb93908

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon May 14 18:24:19 2012 +0200

ole32: Add a NULL pointer check in CoDisconnectObject.

---

 dlls/ole32/compobj.c       |    2 ++
 dlls/ole32/tests/marshal.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 72ba32a..ff8f961 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 c178912..91de43b 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 */




More information about the wine-cvs mailing list