Commit 02da0411 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

ole32: Add helper for string table memory freeing.

parent 380d0cd0
......@@ -657,6 +657,15 @@ FileMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
return MK_S_REDUCED_TO_SELF;
}
static void free_stringtable(LPOLESTR *stringTable)
{
int i;
for (i=0; stringTable[i]!=NULL; i++)
CoTaskMemFree(stringTable[i]);
CoTaskMemFree(stringTable);
}
/******************************************************************************
* FileMoniker_ComposeWith
*/
......@@ -731,12 +740,8 @@ FileMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
}
else res = E_OUTOFMEMORY;
for(i=0; strDec1[i]!=NULL;i++)
CoTaskMemFree(strDec1[i]);
for(i=0; strDec2[i]!=NULL;i++)
CoTaskMemFree(strDec2[i]);
CoTaskMemFree(strDec1);
CoTaskMemFree(strDec2);
free_stringtable(strDec1);
free_stringtable(strDec2);
CoTaskMemFree(str1);
CoTaskMemFree(str2);
......@@ -1005,16 +1010,8 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p
for(i=0;i<sameIdx;i++)
strcatW(commonPath,stringTable1[i]);
for(i=0;i<nb1;i++)
CoTaskMemFree(stringTable1[i]);
CoTaskMemFree(stringTable1);
for(i=0;i<nb2;i++)
CoTaskMemFree(stringTable2[i]);
CoTaskMemFree(stringTable2);
free_stringtable(stringTable1);
free_stringtable(stringTable2);
ret = CreateFileMoniker(commonPath,ppmkPrefix);
}
HeapFree(GetProcessHeap(),0,commonPath);
......@@ -1167,12 +1164,8 @@ FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppm
res=CreateFileMoniker(relPath,ppmkRelPath);
for(j=0; tabStr1[j]!=NULL;j++)
CoTaskMemFree(tabStr1[j]);
for(j=0; tabStr2[j]!=NULL;j++)
CoTaskMemFree(tabStr2[j]);
CoTaskMemFree(tabStr1);
CoTaskMemFree(tabStr2);
free_stringtable(tabStr1);
free_stringtable(tabStr2);
CoTaskMemFree(str1);
CoTaskMemFree(str2);
HeapFree(GetProcessHeap(),0,relPath);
......@@ -1410,9 +1403,7 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa
strcatW(This->filePathName,bkSlash);
}
for(i=0; tabStr[i]!=NULL;i++)
CoTaskMemFree(tabStr[i]);
CoTaskMemFree(tabStr);
free_stringtable(tabStr);
return S_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment