diff --git a/dlls/wbemdisp/locator.c b/dlls/wbemdisp/locator.c index d1f2609998c..a8b1568965f 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 e3d432b91fe..3cc4c86b072 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(); }