setupapi: Fix use after free in trace message (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
079c51f692
commit
babdaffff7
|
@ -1773,7 +1773,7 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
||||||
{
|
{
|
||||||
SC_HANDLE manager = NULL, service = NULL;
|
SC_HANDLE manager = NULL, service = NULL;
|
||||||
struct device *device;
|
struct device *device;
|
||||||
WCHAR *service_name;
|
WCHAR *service_name = NULL;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
|
TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
|
||||||
|
@ -1789,7 +1789,6 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
||||||
service_name = malloc(size);
|
service_name = malloc(size);
|
||||||
if (!RegGetValueW(device->key, NULL, L"Service", RRF_RT_REG_SZ, NULL, service_name, &size))
|
if (!RegGetValueW(device->key, NULL, L"Service", RRF_RT_REG_SZ, NULL, service_name, &size))
|
||||||
service = OpenServiceW(manager, service_name, SERVICE_USER_DEFINED_CONTROL);
|
service = OpenServiceW(manager, service_name, SERVICE_USER_DEFINED_CONTROL);
|
||||||
free(service_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_device(device);
|
remove_device(device);
|
||||||
|
@ -1803,6 +1802,8 @@ BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
||||||
}
|
}
|
||||||
CloseServiceHandle(manager);
|
CloseServiceHandle(manager);
|
||||||
|
|
||||||
|
free(service_name);
|
||||||
|
|
||||||
remove_all_device_ifaces(device);
|
remove_all_device_ifaces(device);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue