Alexandre Julliard : ole32: Fix a couple of reference leaks.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 21 09:47:18 CDT 2016


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Apr 21 17:00:24 2016 +0900

ole32: Fix a couple of reference leaks.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/stg_prop.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index 04e0244..8e1aaef 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -2063,12 +2063,12 @@ static HRESULT PropertyStorage_BaseConstruct(IStream *stm,
     hr = PropertyStorage_CreateDictionaries(*pps);
     if (FAILED(hr))
     {
-        IStream_Release(stm);
         (*pps)->cs.DebugInfo->Spare[0] = 0;
         DeleteCriticalSection(&(*pps)->cs);
         HeapFree(GetProcessHeap(), 0, *pps);
         *pps = NULL;
     }
+    else IStream_AddRef( stm );
 
     return hr;
 }
@@ -2090,11 +2090,7 @@ static HRESULT PropertyStorage_ConstructFromStream(IStream *stm,
             TRACE("PropertyStorage %p constructed\n", ps);
             hr = S_OK;
         }
-        else
-        {
-            PropertyStorage_DestroyDictionaries(ps);
-            HeapFree(GetProcessHeap(), 0, ps);
-        }
+        else IPropertyStorage_Release( &ps->IPropertyStorage_iface );
     }
     return hr;
 }
@@ -2222,6 +2218,8 @@ static HRESULT WINAPI IPropertySetStorage_fnCreate(
 
     r = PropertyStorage_ConstructEmpty(stm, rfmtid, grfFlags, grfMode, ppprstg);
 
+    IStream_Release( stm );
+
 end:
     TRACE("returning 0x%08x\n", r);
     return r;
@@ -2267,6 +2265,8 @@ static HRESULT WINAPI IPropertySetStorage_fnOpen(
 
     r = PropertyStorage_ConstructFromStream(stm, rfmtid, grfMode, ppprstg);
 
+    IStream_Release( stm );
+
 end:
     TRACE("returning 0x%08x\n", r);
     return r;
@@ -2804,6 +2804,8 @@ HRESULT WINAPI StgCreatePropStg(IUnknown *unk, REFFMTID fmt, const CLSID *clsid,
 
         r = PropertyStorage_ConstructEmpty(stm, fmt, flags,
                 STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, prop_stg);
+
+        IStream_Release( stm );
     }
 
 end:
@@ -2847,6 +2849,8 @@ HRESULT WINAPI StgOpenPropStg(IUnknown *unk, REFFMTID fmt, DWORD flags,
 
         r = PropertyStorage_ConstructFromStream(stm, fmt,
                 STGM_READWRITE|STGM_SHARE_EXCLUSIVE, prop_stg);
+
+        IStream_Release( stm );
     }
 
 end:




More information about the wine-cvs mailing list