wbemprox: Set obj to NULL on error in get_object().
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9b7f14f1b4
commit
11f2057768
|
@ -463,7 +463,11 @@ HRESULT get_object( const WCHAR *object_path, IWbemClassObject **obj )
|
|||
return hr;
|
||||
}
|
||||
hr = IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, obj, &count );
|
||||
if (hr == WBEM_S_FALSE) hr = WBEM_E_NOT_FOUND;
|
||||
if (hr == WBEM_S_FALSE)
|
||||
{
|
||||
hr = WBEM_E_NOT_FOUND;
|
||||
*obj = NULL;
|
||||
}
|
||||
IEnumWbemClassObject_Release( iter );
|
||||
free_path( path );
|
||||
return hr;
|
||||
|
|
|
@ -338,19 +338,23 @@ static void test_Win32_Service( IWbemServices *services )
|
|||
service = NULL;
|
||||
hr = IWbemServices_GetObject( services, NULL, 0, NULL, &service, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
if (service) IWbemClassObject_Release( service );
|
||||
ok( !!service, "expected non-NULL service\n" );
|
||||
IWbemClassObject_Release( service );
|
||||
|
||||
service = NULL;
|
||||
hr = IWbemServices_GetObject( services, empty, 0, NULL, &service, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
if (service) IWbemClassObject_Release( service );
|
||||
ok( !!service, "expected non-NULL service\n" );
|
||||
IWbemClassObject_Release( service );
|
||||
|
||||
SysFreeString( empty );
|
||||
SysFreeString( class );
|
||||
|
||||
class = SysAllocString( L"Win32_Service.Name=\"nonexistent\"" );
|
||||
service = (IWbemClassObject *)0xdeadbeef;
|
||||
hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL );
|
||||
ok( hr == WBEM_E_NOT_FOUND, "got %#08x\n", hr );
|
||||
ok( service == NULL, "expected NULL service, got %p\n", service );
|
||||
SysFreeString( class );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue