Alexander Dorofeyev : quartz: Improve variant handling in FilterMapper_EnumMatchingFilters.

Alexandre Julliard julliard at winehq.org
Tue Jul 1 08:27:47 CDT 2008


Module: wine
Branch: master
Commit: 9778faee0b62c09586d73e30f8640887e1c4d17f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9778faee0b62c09586d73e30f8640887e1c4d17f

Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date:   Sun Jun 29 15:07:24 2008 +0300

quartz: Improve variant handling in FilterMapper_EnumMatchingFilters.

Adds VariantClear and removes unnecessary variant type assignment that may cause 
heap corruption.

---

 dlls/quartz/filtermapper.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index c4b925c..ef603d8 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -1257,7 +1257,6 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
         int len;
 
         VariantInit(&var);
-        V_VT(&var) = VT_BSTR;
 
         hrSub = IMoniker_BindToStorage(IMon, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
 
@@ -1267,6 +1266,8 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
         if (SUCCEEDED(hrSub))
             hrSub = CLSIDFromString(V_UNION(&var, bstrVal), &clsid);
 
+        VariantClear(&var);
+
         if (SUCCEEDED(hrSub))
             hrSub = IPropertyBag_Read(pPropBagCat, wszFriendlyName, &var, NULL);
 
@@ -1287,6 +1288,7 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
         if (pPropBagCat)
             IPropertyBag_Release(pPropBagCat);
         IMoniker_Release(IMon);
+        VariantClear(&var);
     }
 
     /* In case of release all resources */




More information about the wine-cvs mailing list