Commit d7218138 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: pFmt isn't exposed to the client, so simplify its allocation.

parent 8beb8386
...@@ -231,7 +231,6 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_AddRef(LPENUMFORMATETC iface) ...@@ -231,7 +231,6 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_AddRef(LPENUMFORMATETC iface)
static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface) static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface)
{ {
IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface; IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
LPMALLOC pIMalloc;
ULONG ref; ULONG ref;
TRACE("(%p)->(count=%u)\n",This, This->ref); TRACE("(%p)->(count=%u)\n",This, This->ref);
...@@ -243,12 +242,7 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface) ...@@ -243,12 +242,7 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface)
if (!ref) if (!ref)
{ {
TRACE("() - destroying IEnumFORMATETC(%p)\n",This); TRACE("() - destroying IEnumFORMATETC(%p)\n",This);
if (SUCCEEDED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) HeapFree(GetProcessHeap(), 0, This->pFmt);
{
IMalloc_Free(pIMalloc, This->pFmt);
IMalloc_Release(pIMalloc);
}
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
} }
return ref; return ref;
...@@ -379,9 +373,8 @@ static LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORM ...@@ -379,9 +373,8 @@ static LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORM
{ {
IEnumFORMATETCImpl* ef; IEnumFORMATETCImpl* ef;
DWORD size=cfmt * sizeof(FORMATETC); DWORD size=cfmt * sizeof(FORMATETC);
LPMALLOC pIMalloc;
ef = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl)); ef = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumFORMATETCImpl));
if (!ef) if (!ef)
return NULL; return NULL;
...@@ -391,15 +384,14 @@ static LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORM ...@@ -391,15 +384,14 @@ static LPENUMFORMATETC OLEClipbrd_IEnumFORMATETC_Construct(UINT cfmt, const FORM
ef->posFmt = 0; ef->posFmt = 0;
ef->countFmt = cfmt; ef->countFmt = cfmt;
if (FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc))) { ef->pFmt = HeapAlloc(GetProcessHeap(), 0, size);
if (ef->pFmt)
memcpy(ef->pFmt, afmt, size);
else
{
HeapFree(GetProcessHeap(), 0, ef); HeapFree(GetProcessHeap(), 0, ef);
return NULL; return NULL;
} }
ef->pFmt = IMalloc_Alloc(pIMalloc, size);
IMalloc_Release(pIMalloc);
if (ef->pFmt)
memcpy(ef->pFmt, afmt, size);
TRACE("(%p)->()\n",ef); TRACE("(%p)->()\n",ef);
return (LPENUMFORMATETC)ef; return (LPENUMFORMATETC)ef;
......
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