ole32: Fix some leaks (coverity).

This commit is contained in:
Frédéric Delanoy 2012-11-26 12:41:42 +01:00 committed by Alexandre Julliard
parent 02da0411e1
commit 8ddb00b22b
1 changed files with 14 additions and 2 deletions

View File

@ -973,10 +973,17 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p
return nb1; return nb1;
nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2); nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2);
if (FAILED(nb2)) if (FAILED(nb2))
{
free_stringtable(stringTable1);
return nb2; return nb2;
}
if (nb1==0 || nb2==0) if (nb1==0 || nb2==0)
{
free_stringtable(stringTable1);
free_stringtable(stringTable2);
return MK_E_NOPREFIX; return MK_E_NOPREFIX;
}
commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1)); commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1));
if (!commonPath) if (!commonPath)
@ -1136,10 +1143,15 @@ FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppm
return res; return res;
len1=FileMonikerImpl_DecomposePath(str1,&tabStr1); len1=FileMonikerImpl_DecomposePath(str1,&tabStr1);
if (FAILED(len1))
return E_OUTOFMEMORY;
len2=FileMonikerImpl_DecomposePath(str2,&tabStr2); len2=FileMonikerImpl_DecomposePath(str2,&tabStr2);
if (FAILED(len1) || FAILED(len2)) if (FAILED(len2))
{
free_stringtable(tabStr1);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
/* count the number of similar items from the begin of the two paths */ /* count the number of similar items from the begin of the two paths */
for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) && for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) &&