[PATCH 0/1] MR189: windows.gaming.input: Fix a leak on error path (Coverity).
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/189
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/windows.gaming.input/async.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/windows.gaming.input/async.c b/dlls/windows.gaming.input/async.c index 2cb6e51c9c5..8483f301b83 100644 --- a/dlls/windows.gaming.input/async.c +++ b/dlls/windows.gaming.input/async.c @@ -335,6 +335,7 @@ static HRESULT async_info_create( IUnknown *invoker, IUnknown *param, async_oper IInspectable *outer, IWineAsyncInfoImpl **out ) { struct async_info *impl; + HRESULT hr; if (!(impl = calloc( 1, sizeof(struct async_info) ))) return E_OUTOFMEMORY; impl->IWineAsyncInfoImpl_iface.lpVtbl = &async_impl_vtbl; @@ -346,7 +347,11 @@ static HRESULT async_info_create( IUnknown *invoker, IUnknown *param, async_oper impl->handler = HANDLER_NOT_SET; impl->status = Started; if (!(impl->async_run_work = CreateThreadpoolWork( async_info_callback, &impl->IWineAsyncInfoImpl_iface, NULL ))) - return HRESULT_FROM_WIN32( GetLastError() ); + { + hr = HRESULT_FROM_WIN32( GetLastError() ); + free( impl ); + return hr; + } if ((impl->invoker = invoker)) IUnknown_AddRef( impl->invoker ); if ((impl->param = param)) IUnknown_AddRef( impl->param ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/189
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/189
participants (3)
-
Nikolay Sivov -
Nikolay Sivov (@nsivov) -
Rémi Bernon