[PATCH] wincodecs: Simplify property name allocation

Nikolay Sivov nsivov at codeweavers.com
Thu Nov 24 03:23:46 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/windowscodecs/propertybag.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/dlls/windowscodecs/propertybag.c b/dlls/windowscodecs/propertybag.c
index 8e81ec0..2f3015c 100644
--- a/dlls/windowscodecs/propertybag.c
+++ b/dlls/windowscodecs/propertybag.c
@@ -94,7 +94,7 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag2 *iface)
         {
             for (i=0; i < This->prop_count; i++)
             {
-                HeapFree(GetProcessHeap(), 0, This->properties[i].pstrName);
+                CoTaskMemFree(This->properties[i].pstrName);
                 VariantClear( This->values+i );
             }
         }
@@ -213,18 +213,14 @@ static HRESULT WINAPI PropertyBag_CountProperties(IPropertyBag2 *iface, ULONG *p
     return S_OK;
 }
 
-static HRESULT copy_propbag2(PROPBAG2 *dest, PROPBAG2 *src, BOOL useCoAlloc)
+static HRESULT copy_propbag2(PROPBAG2 *dest, PROPBAG2 *src)
 {
     dest->cfType = src->cfType;
     dest->clsid = src->clsid;
     dest->dwHint = src->dwHint;
     dest->dwType = src->dwType;
     dest->vt = src->vt;
-    if(useCoAlloc)
-        dest->pstrName = CoTaskMemAlloc((strlenW(src->pstrName)+1) * sizeof(WCHAR));
-    else
-        dest->pstrName = HeapAlloc(GetProcessHeap(), 0, (strlenW(src->pstrName)+1) * sizeof(WCHAR));
-
+    dest->pstrName = CoTaskMemAlloc((strlenW(src->pstrName)+1) * sizeof(WCHAR));
     if(!dest->pstrName)
         return E_OUTOFMEMORY;
 
@@ -251,7 +247,7 @@ static HRESULT WINAPI PropertyBag_GetPropertyInfo(IPropertyBag2 *iface, ULONG iP
 
     for (i=0; i < *pcProperties; i++)
     {
-        res = copy_propbag2(pPropBag+i, This->properties+iProperty+i, TRUE);
+        res = copy_propbag2(pPropBag+i, This->properties+iProperty+i);
         if (FAILED(res))
         {
             do {
@@ -311,7 +307,7 @@ HRESULT CreatePropertyBag2(PROPBAG2 *options, UINT count,
         else
             for (i=0; i < count; i++)
             {
-                res = copy_propbag2(This->properties+i, options+i, FALSE);
+                res = copy_propbag2(This->properties+i, options+i);
                 if (FAILED(res))
                     break;
                 This->properties[i].dwHint = i+1; /* 0 means unset, so we start with 1 */
-- 
2.10.2




More information about the wine-patches mailing list