wbemdisp: Fix a crash on null interface pointer.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-07-15 23:22:50 +03:00 committed by Alexandre Julliard
parent a1ee6fa8dd
commit 1fda7ca72e
2 changed files with 16 additions and 1 deletions

View File

@ -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;

View File

@ -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();
}