[PATCH] oleaut32: ICreateTypeInfo2::AddVarDesc() should handle failure of allocation and initialization of a variant description.

Dmitry Timoshkov dmitry at baikal.ru
Fri Jun 25 05:12:11 CDT 2021


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/oleaut32/typelib.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 4669b03d5fc..0526af0abdb 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -11019,6 +11019,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(ICreateTypeInfo2 *iface,
 {
     ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface);
     TLBVarDesc *var_desc;
+    HRESULT hr;
 
     TRACE("%p %u %p\n", This, index, varDesc);
 
@@ -11044,7 +11045,9 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(ICreateTypeInfo2 *iface,
         var_desc = This->vardescs = heap_alloc_zero(sizeof(TLBVarDesc));
 
     TLBVarDesc_Constructor(var_desc);
-    TLB_AllocAndInitVarDesc(varDesc, &var_desc->vardesc_create);
+    hr = TLB_AllocAndInitVarDesc(varDesc, &var_desc->vardesc_create);
+    if (FAILED(hr))
+        return hr;
     var_desc->vardesc = *var_desc->vardesc_create;
 
     ++This->typeattr.cVars;
-- 
2.31.1




More information about the wine-devel mailing list