 
            Found by ASan.
 
            From: Yuxuan Shui yshui@codeweavers.com
--- dlls/windows.devices.enumeration/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/windows.devices.enumeration/main.c b/dlls/windows.devices.enumeration/main.c index 8a6596b682f..37db9e53f24 100644 --- a/dlls/windows.devices.enumeration/main.c +++ b/dlls/windows.devices.enumeration/main.c @@ -527,7 +527,7 @@ static HRESULT WINAPI devpropcompkeys_append_names( DEVPROPCOMPKEY **ret_keys, U WindowsDeleteString( name ); if (FAILED(hr)) break; /* DevGetObjects(Ex) will not de-duplicate properties, so we need to do it ourselves. */ - if (!devpropcompkey_buf_find_devpropkey( *ret_keys, keys_len, key.Key )) + if (!devpropcompkey_buf_find_devpropkey( keys, keys_len, key.Key )) keys[keys_len++] = key; }
 
            From: Yuxuan Shui yshui@codeweavers.com
If devpropcompkeys_append_names fails after the realloc, *ret_keys will contain a dangling pointer. But both of its callers assume it's safe to call free on *ret_keys when devpropcompkeys_append_names fails, resulting in double freeing. --- dlls/windows.devices.enumeration/main.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/windows.devices.enumeration/main.c b/dlls/windows.devices.enumeration/main.c index 37db9e53f24..6a4505c9649 100644 --- a/dlls/windows.devices.enumeration/main.c +++ b/dlls/windows.devices.enumeration/main.c @@ -510,6 +510,8 @@ static HRESULT WINAPI devpropcompkeys_append_names( DEVPROPCOMPKEY **ret_keys, U
if (FAILED(hr = count_iterable( names_iterable, &count ))) return hr; if (!(keys = realloc( *ret_keys, (keys_len + count) * sizeof( *keys ) ))) return E_OUTOFMEMORY; + *ret_keys = NULL; + *ret_keys_len = 0;
if (FAILED(hr = IIterable_HSTRING_First( names_iterable, &names ))) return hr; for (hr = IIterator_HSTRING_get_HasCurrent( names, &valid ); SUCCEEDED( hr ) && valid; hr = IIterator_HSTRING_MoveNext( names, &valid ))
 
            This merge request was approved by Vibhav Pant.


