[2/2] ole32: Fix some leaks (coverity) (try 2)

Frédéric Delanoy frederic.delanoy at gmail.com
Mon Nov 26 05:41:42 CST 2012


CIDs 713614-713615 713618-713619
---
 dlls/ole32/filemoniker.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c
index 7f9600a..d6482c7 100644
--- a/dlls/ole32/filemoniker.c
+++ b/dlls/ole32/filemoniker.c
@@ -974,10 +974,17 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p
             return nb1;
         nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2);
         if (FAILED(nb2))
+        {
+            free_stringtable(stringTable1);
             return nb2;
+        }
 
         if (nb1==0 || nb2==0)
+        {
+            free_stringtable(stringTable1);
+            free_stringtable(stringTable2);
             return MK_E_NOPREFIX;
+        }
 
         commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1));
         if (!commonPath)
@@ -1137,10 +1144,15 @@ FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppm
 	return res;
 
     len1=FileMonikerImpl_DecomposePath(str1,&tabStr1);
+    if (FAILED(len1))
+        return E_OUTOFMEMORY;
     len2=FileMonikerImpl_DecomposePath(str2,&tabStr2);
 
-    if (FAILED(len1) || FAILED(len2))
-	return E_OUTOFMEMORY;
+    if (FAILED(len2))
+    {
+        free_stringtable(tabStr1);
+        return E_OUTOFMEMORY;
+    }
 
     /* count the number of similar items from the begin of the two paths */
     for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) &&
-- 
1.8.0




More information about the wine-patches mailing list