Nikolay Sivov : windows.gaming.input: Fix a leak on error path (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Jun 6 16:10:29 CDT 2022


Module: wine
Branch: master
Commit: ea4c506cd75feb6a5c4791c7f7cc453237249c2f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ea4c506cd75feb6a5c4791c7f7cc453237249c2f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jun  5 10:03:47 2022 +0300

windows.gaming.input: Fix a leak on error path (Coverity).

Signed-off-by: Nikolay Sivov <nsivov at 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 );




More information about the wine-cvs mailing list