Kevin Puetz : oleaut32: Fix error handling/reporting in TLB_copy_all_custdata.

Alexandre Julliard julliard at winehq.org
Wed Nov 18 15:48:02 CST 2020


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

Author: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Date:   Tue Nov 17 19:14:18 2020 -0600

oleaut32: Fix error handling/reporting in TLB_copy_all_custdata.

VariantCopy clears existing contents of pvargDest and thus requires
it contain a valid (possibly-empty) VARIANT, not uninitialized garbage.

If a failure still occurs, propgate the HRESULT to GetAll*CustData.

Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/typelib.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 989340de9c2..d04e4d2cbe2 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -5288,6 +5288,7 @@ static HRESULT TLB_copy_all_custdata(const struct list *custdata_list, CUSTDATA
     TLBCustData *pCData;
     unsigned int ct;
     CUSTDATAITEM *cdi;
+    HRESULT hr = S_OK;
 
     ct = list_count(custdata_list);
 
@@ -5300,11 +5301,13 @@ static HRESULT TLB_copy_all_custdata(const struct list *custdata_list, CUSTDATA
     cdi = pCustData->prgCustData;
     LIST_FOR_EACH_ENTRY(pCData, custdata_list, TLBCustData, entry){
         cdi->guid = *TLB_get_guid_null(pCData->guid);
-        VariantCopy(&cdi->varValue, &pCData->data);
+        VariantInit(&cdi->varValue);
+        hr = VariantCopy(&cdi->varValue, &pCData->data);
+        if(FAILED(hr)) break;
         ++cdi;
     }
 
-    return S_OK;
+    return hr;
 }
 
 




More information about the wine-cvs mailing list