[PATCH 0/1] MR7866: windows.devices.enumeration: Guard against WindowsDuplicateString() failure.
From: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- dlls/windows.devices.enumeration/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/windows.devices.enumeration/main.c b/dlls/windows.devices.enumeration/main.c index e1f8b5c5ae5..5c930dba121 100644 --- a/dlls/windows.devices.enumeration/main.c +++ b/dlls/windows.devices.enumeration/main.c @@ -377,6 +377,7 @@ static HRESULT WINAPI device_statics_CreateWatcherDeviceClass( IDeviceInformatio static HRESULT WINAPI device_statics_CreateWatcherAqsFilter( IDeviceInformationStatics *iface, HSTRING filter, IDeviceWatcher **watcher ) { struct device_watcher *this; + HRESULT hr; TRACE( "iface %p, filter %s, watcher %p\n", iface, debugstr_hstring(filter), watcher ); @@ -384,7 +385,11 @@ static HRESULT WINAPI device_statics_CreateWatcherAqsFilter( IDeviceInformationS this->IDeviceWatcher_iface.lpVtbl = &device_watcher_vtbl; this->ref = 1; - WindowsDuplicateString( filter, &this->filter ); + if (FAILED(hr = WindowsDuplicateString( filter, &this->filter ))) + { + free( this ); + return hr; + } list_init( &this->stopped_handlers ); @@ -453,6 +458,7 @@ static HRESULT WINAPI device_statics2_CreateWatcher( IDeviceInformationStatics2 IDeviceWatcher **watcher ) { struct device_watcher *this; + HRESULT hr; FIXME( "iface %p, filter %s, additional_properties %p, kind %u, watcher %p semi-stub!\n", iface, debugstr_hstring( filter ), additional_properties, kind, watcher ); @@ -462,7 +468,11 @@ static HRESULT WINAPI device_statics2_CreateWatcher( IDeviceInformationStatics2 this->IDeviceWatcher_iface.lpVtbl = &device_watcher_vtbl; this->ref = 1; - WindowsDuplicateString( filter, &this->filter ); + if (FAILED(hr = WindowsDuplicateString( filter, &this->filter ))) + { + free( this ); + return hr; + } list_init( &this->stopped_handlers ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7866
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/7866
participants (3)
-
Mohamad Al-Jaf -
Mohamad Al-Jaf (@maljaf) -
Rémi Bernon