ole32: Fix some memory leaks.

This commit is contained in:
Andrew Talbot 2007-10-01 20:17:29 +01:00 committed by Alexandre Julliard
parent 881e5740c4
commit 001d36b10e
1 changed files with 16 additions and 4 deletions

View File

@ -1813,14 +1813,18 @@ CompositeMonikerImpl_Construct(IMoniker** ppMoniker,
if (++This->tabLastIndex==This->tabSize){
LPVOID tab_moniker = This->tabMoniker;
This->tabSize+=BLOCK_TAB_SIZE;
This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
if (This->tabMoniker==NULL)
if (This->tabMoniker==NULL){
HeapFree(GetProcessHeap(), 0, tab_moniker);
HeapFree(GetProcessHeap(), 0, This);
return E_OUTOFMEMORY;
}
}
}
IEnumMoniker_Release(enumMoniker);
}
@ -1862,15 +1866,19 @@ CompositeMonikerImpl_Construct(IMoniker** ppMoniker,
/* resize tabMoniker if needed */
if (This->tabLastIndex==This->tabSize){
LPVOID tab_moniker = This->tabMoniker;
This->tabSize+=BLOCK_TAB_SIZE;
This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
if (This->tabMoniker==NULL)
if (This->tabMoniker==NULL){
HeapFree(GetProcessHeap(), 0, tab_moniker);
HeapFree(GetProcessHeap(), 0, This);
return E_OUTOFMEMORY;
}
}
}
else{
/* add a composite moniker to the moniker table (do the same thing
@ -1901,15 +1909,19 @@ CompositeMonikerImpl_Construct(IMoniker** ppMoniker,
}
if (This->tabLastIndex==This->tabSize){
LPVOID tab_moniker = This->tabMoniker;
This->tabSize+=BLOCK_TAB_SIZE;
This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
if (This->tabMoniker==NULL)
if (This->tabMoniker==NULL){
HeapFree(GetProcessHeap(), 0, tab_moniker);
HeapFree(GetProcessHeap(), 0, This);
return E_OUTOFMEMORY;
}
}
}
IEnumMoniker_Release(enumMoniker);
}