[PATCH] wbemdisp: Fix a crash on null interface pointer
Nikolay Sivov
nsivov at codeweavers.com
Fri Jul 15 15:22:50 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
For https://bugs.winehq.org/show_bug.cgi?id=40959
dlls/wbemdisp/locator.c | 3 ++-
dlls/wbemdisp/tests/wbemdisp.c | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/wbemdisp/locator.c b/dlls/wbemdisp/locator.c
index d1f2609..a8b1568 100644
--- a/dlls/wbemdisp/locator.c
+++ b/dlls/wbemdisp/locator.c
@@ -1224,7 +1224,8 @@ static ULONG WINAPI locator_Release(
if (!refs)
{
TRACE( "destroying %p\n", locator );
- IWbemLocator_Release( locator->locator );
+ if (locator->locator)
+ IWbemLocator_Release( locator->locator );
heap_free( locator );
}
return refs;
diff --git a/dlls/wbemdisp/tests/wbemdisp.c b/dlls/wbemdisp/tests/wbemdisp.c
index e3d432b..3cc4c86 100644
--- a/dlls/wbemdisp/tests/wbemdisp.c
+++ b/dlls/wbemdisp/tests/wbemdisp.c
@@ -243,9 +243,23 @@ static void test_ParseDisplayName(void)
IParseDisplayName_Release( displayname );
}
+static void test_locator(void)
+{
+ IUnknown *locator;
+ HRESULT hr;
+
+ hr = CoCreateInstance( &CLSID_SWbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&locator );
+ ok( hr == S_OK, "got %x\n", hr );
+
+ IUnknown_Release( locator );
+}
+
START_TEST(wbemdisp)
{
CoInitialize( NULL );
+
test_ParseDisplayName();
+ test_locator();
+
CoUninitialize();
}
--
2.8.1
More information about the wine-patches
mailing list