Commit 7d2bd1e4 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

windowscodecs: Use CRT allocation functions.

parent 7d013ed8
...@@ -162,7 +162,7 @@ static ULONG WINAPI BitmapLockImpl_Release(IWICBitmapLock *iface) ...@@ -162,7 +162,7 @@ static ULONG WINAPI BitmapLockImpl_Release(IWICBitmapLock *iface)
{ {
BitmapImpl_ReleaseLock(This->parent); BitmapImpl_ReleaseLock(This->parent);
IWICBitmap_Release(&This->parent->IWICBitmap_iface); IWICBitmap_Release(&This->parent->IWICBitmap_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -287,8 +287,8 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface) ...@@ -287,8 +287,8 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
if (This->view) if (This->view)
UnmapViewOfFile(This->view); UnmapViewOfFile(This->view);
else else
HeapFree(GetProcessHeap(), 0, This->data); free(This->data);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -392,13 +392,13 @@ static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock, ...@@ -392,13 +392,13 @@ static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
return E_FAIL; return E_FAIL;
} }
result = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapLockImpl)); result = malloc(sizeof(BitmapLockImpl));
if (!result) if (!result)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (!BitmapImpl_AcquireLock(This, flags & WICBitmapLockWrite)) if (!BitmapImpl_AcquireLock(This, flags & WICBitmapLockWrite))
{ {
HeapFree(GetProcessHeap(), 0, result); free(result);
return WINCODEC_ERR_ALREADYLOCKED; return WINCODEC_ERR_ALREADYLOCKED;
} }
...@@ -798,13 +798,13 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasiz ...@@ -798,13 +798,13 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasiz
if (datasize < stride * uiHeight) return WINCODEC_ERR_INSUFFICIENTBUFFER; if (datasize < stride * uiHeight) return WINCODEC_ERR_INSUFFICIENTBUFFER;
if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG; if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl)); This = malloc(sizeof(BitmapImpl));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
if (view) data = (BYTE *)view + offset; if (view) data = (BYTE *)view + offset;
else if (!(data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize))) else if (!(data = calloc(1, datasize)))
{ {
HeapFree(GetProcessHeap(), 0, This); free(This);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
......
...@@ -224,9 +224,9 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, ...@@ -224,9 +224,9 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
int i; int i;
count = 1 << bch->bcBitCount; count = 1 << bch->bcBitCount;
wiccolors = HeapAlloc(GetProcessHeap(), 0, sizeof(WICColor) * count); wiccolors = malloc(sizeof(WICColor) * count);
tablesize = sizeof(RGBTRIPLE) * count; tablesize = sizeof(RGBTRIPLE) * count;
bgrcolors = HeapAlloc(GetProcessHeap(), 0, tablesize); bgrcolors = malloc(tablesize);
if (!wiccolors || !bgrcolors) if (!wiccolors || !bgrcolors)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -272,7 +272,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, ...@@ -272,7 +272,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
count = min(This->bih.bV5ClrUsed, 1 << This->bih.bV5BitCount); count = min(This->bih.bV5ClrUsed, 1 << This->bih.bV5BitCount);
tablesize = sizeof(WICColor) * count; tablesize = sizeof(WICColor) * count;
wiccolors = HeapAlloc(GetProcessHeap(), 0, tablesize); wiccolors = malloc(tablesize);
if (!wiccolors) if (!wiccolors)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -308,8 +308,8 @@ end: ...@@ -308,8 +308,8 @@ end:
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IWICPalette_InitializeCustom(pIPalette, wiccolors, count); hr = IWICPalette_InitializeCustom(pIPalette, wiccolors, count);
HeapFree(GetProcessHeap(), 0, wiccolors); free(wiccolors);
HeapFree(GetProcessHeap(), 0, bgrcolors); free(bgrcolors);
return hr; return hr;
} }
...@@ -386,7 +386,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This) ...@@ -386,7 +386,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This)
bytesperrow = (((width * This->bitsperpixel)+31)/32)*4; bytesperrow = (((width * This->bitsperpixel)+31)/32)*4;
datasize = bytesperrow * height; datasize = bytesperrow * height;
This->imagedata = HeapAlloc(GetProcessHeap(), 0, datasize); This->imagedata = malloc(datasize);
if (!This->imagedata) return E_OUTOFMEMORY; if (!This->imagedata) return E_OUTOFMEMORY;
offbits.QuadPart = This->image_offset; offbits.QuadPart = This->image_offset;
...@@ -409,7 +409,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This) ...@@ -409,7 +409,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This)
return S_OK; return S_OK;
fail: fail:
HeapFree(GetProcessHeap(), 0, This->imagedata); free(This->imagedata);
This->imagedata = NULL; This->imagedata = NULL;
if (SUCCEEDED(hr)) hr = E_FAIL; if (SUCCEEDED(hr)) hr = E_FAIL;
return hr; return hr;
...@@ -480,7 +480,7 @@ static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder* This) ...@@ -480,7 +480,7 @@ static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder* This)
else else
palettesize = 4 * 256; palettesize = 4 * 256;
This->imagedata = HeapAlloc(GetProcessHeap(), 0, datasize); This->imagedata = malloc(datasize);
if (!This->imagedata) if (!This->imagedata)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -576,7 +576,7 @@ end: ...@@ -576,7 +576,7 @@ end:
return S_OK; return S_OK;
fail: fail:
HeapFree(GetProcessHeap(), 0, This->imagedata); free(This->imagedata);
This->imagedata = NULL; This->imagedata = NULL;
if (SUCCEEDED(hr)) hr = E_FAIL; if (SUCCEEDED(hr)) hr = E_FAIL;
return hr; return hr;
...@@ -604,7 +604,7 @@ static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder* This) ...@@ -604,7 +604,7 @@ static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder* This)
else else
palettesize = 4 * 16; palettesize = 4 * 16;
This->imagedata = HeapAlloc(GetProcessHeap(), 0, datasize); This->imagedata = malloc(datasize);
if (!This->imagedata) if (!This->imagedata)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -716,7 +716,7 @@ end: ...@@ -716,7 +716,7 @@ end:
return S_OK; return S_OK;
fail: fail:
HeapFree(GetProcessHeap(), 0, This->imagedata); free(This->imagedata);
This->imagedata = NULL; This->imagedata = NULL;
if (SUCCEEDED(hr)) hr = E_FAIL; if (SUCCEEDED(hr)) hr = E_FAIL;
return hr; return hr;
...@@ -1011,10 +1011,10 @@ static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface) ...@@ -1011,10 +1011,10 @@ static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
if (ref == 0) if (ref == 0)
{ {
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This->imagedata); free(This->imagedata);
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1152,7 +1152,7 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode ...@@ -1152,7 +1152,7 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode
{ {
BmpDecoder *This; BmpDecoder *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpDecoder)); This = malloc(sizeof(BmpDecoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &BmpDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &BmpDecoder_Vtbl;
......
...@@ -125,8 +125,8 @@ static ULONG WINAPI BmpFrameEncode_Release(IWICBitmapFrameEncode *iface) ...@@ -125,8 +125,8 @@ static ULONG WINAPI BmpFrameEncode_Release(IWICBitmapFrameEncode *iface)
if (ref == 0) if (ref == 0)
{ {
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This->bits); free(This->bits);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -249,7 +249,7 @@ static HRESULT BmpFrameEncode_AllocateBits(BmpFrameEncode *This) ...@@ -249,7 +249,7 @@ static HRESULT BmpFrameEncode_AllocateBits(BmpFrameEncode *This)
return WINCODEC_ERR_WRONGSTATE; return WINCODEC_ERR_WRONGSTATE;
This->stride = (((This->width * This->format->bpp)+31)/32)*4; This->stride = (((This->width * This->format->bpp)+31)/32)*4;
This->bits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->stride * This->height); This->bits = calloc(This->stride, This->height);
if (!This->bits) return E_OUTOFMEMORY; if (!This->bits) return E_OUTOFMEMORY;
} }
...@@ -482,7 +482,7 @@ static ULONG WINAPI BmpEncoder_Release(IWICBitmapEncoder *iface) ...@@ -482,7 +482,7 @@ static ULONG WINAPI BmpEncoder_Release(IWICBitmapEncoder *iface)
{ {
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
if (This->frame) IWICBitmapFrameEncode_Release(&This->frame->IWICBitmapFrameEncode_iface); if (This->frame) IWICBitmapFrameEncode_Release(&This->frame->IWICBitmapFrameEncode_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -581,7 +581,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -581,7 +581,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
} }
encode = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpFrameEncode)); encode = malloc(sizeof(BmpFrameEncode));
if (!encode) if (!encode)
{ {
IPropertyBag2_Release(*ppIEncoderOptions); IPropertyBag2_Release(*ppIEncoderOptions);
...@@ -651,7 +651,7 @@ HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) ...@@ -651,7 +651,7 @@ HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpEncoder)); This = malloc(sizeof(BmpEncoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapEncoder_iface.lpVtbl = &BmpEncoder_Vtbl; This->IWICBitmapEncoder_iface.lpVtbl = &BmpEncoder_Vtbl;
......
...@@ -89,7 +89,7 @@ static ULONG WINAPI BitmapClipper_Release(IWICBitmapClipper *iface) ...@@ -89,7 +89,7 @@ static ULONG WINAPI BitmapClipper_Release(IWICBitmapClipper *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->source) IWICBitmapSource_Release(This->source); if (This->source) IWICBitmapSource_Release(This->source);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -244,7 +244,7 @@ HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper) ...@@ -244,7 +244,7 @@ HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper)
{ {
BitmapClipper *This; BitmapClipper *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapClipper)); This = malloc(sizeof(BitmapClipper));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapClipper_iface.lpVtbl = &BitmapClipper_Vtbl; This->IWICBitmapClipper_iface.lpVtbl = &BitmapClipper_Vtbl;
......
...@@ -127,7 +127,7 @@ static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface) ...@@ -127,7 +127,7 @@ static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface)
TRACE("(%p) refcount=%lu\n", iface, ref); TRACE("(%p) refcount=%lu\n", iface, ref);
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -165,7 +165,7 @@ static HRESULT ClassFactoryImpl_Constructor(const classinfo *info, REFIID riid, ...@@ -165,7 +165,7 @@ static HRESULT ClassFactoryImpl_Constructor(const classinfo *info, REFIID riid,
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassFactoryImpl)); This = malloc(sizeof(ClassFactoryImpl));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IClassFactory_iface.lpVtbl = &ClassFactoryImpl_Vtbl; This->IClassFactory_iface.lpVtbl = &ClassFactoryImpl_Vtbl;
......
...@@ -86,8 +86,8 @@ static ULONG WINAPI ColorContext_Release(IWICColorContext *iface) ...@@ -86,8 +86,8 @@ static ULONG WINAPI ColorContext_Release(IWICColorContext *iface)
if (ref == 0) if (ref == 0)
{ {
HeapFree(GetProcessHeap(), 0, This->profile); free(This->profile);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -116,7 +116,7 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len) ...@@ -116,7 +116,7 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len)
CloseHandle(handle); CloseHandle(handle);
return E_FAIL; return E_FAIL;
} }
if (!(*profile = HeapAlloc(GetProcessHeap(), 0, size.u.LowPart))) if (!(*profile = malloc(size.u.LowPart)))
{ {
CloseHandle(handle); CloseHandle(handle);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -124,12 +124,12 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len) ...@@ -124,12 +124,12 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len)
ret = ReadFile(handle, *profile, size.u.LowPart, &count, NULL); ret = ReadFile(handle, *profile, size.u.LowPart, &count, NULL);
CloseHandle(handle); CloseHandle(handle);
if (!ret) { if (!ret) {
HeapFree (GetProcessHeap(),0,*profile); free(*profile);
*profile = NULL; *profile = NULL;
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
} }
if (count != size.u.LowPart) { if (count != size.u.LowPart) {
HeapFree (GetProcessHeap(),0,*profile); free(*profile);
*profile = NULL; *profile = NULL;
return E_FAIL; return E_FAIL;
} }
...@@ -154,7 +154,7 @@ static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *ifac ...@@ -154,7 +154,7 @@ static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *ifac
hr = load_profile(wzFilename, &profile, &len); hr = load_profile(wzFilename, &profile, &len);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
HeapFree(GetProcessHeap(), 0, This->profile); free(This->profile);
This->profile = profile; This->profile = profile;
This->profile_len = len; This->profile_len = len;
This->type = WICColorContextProfile; This->type = WICColorContextProfile;
...@@ -172,10 +172,10 @@ static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface, ...@@ -172,10 +172,10 @@ static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface,
if (This->type != WICColorContextUninitialized && This->type != WICColorContextProfile) if (This->type != WICColorContextUninitialized && This->type != WICColorContextProfile)
return WINCODEC_ERR_WRONGSTATE; return WINCODEC_ERR_WRONGSTATE;
if (!(profile = HeapAlloc(GetProcessHeap(), 0, cbBufferSize))) return E_OUTOFMEMORY; if (!(profile = malloc(cbBufferSize))) return E_OUTOFMEMORY;
memcpy(profile, pbBuffer, cbBufferSize); memcpy(profile, pbBuffer, cbBufferSize);
HeapFree(GetProcessHeap(), 0, This->profile); free(This->profile);
This->profile = profile; This->profile = profile;
This->profile_len = cbBufferSize; This->profile_len = cbBufferSize;
This->type = WICColorContextProfile; This->type = WICColorContextProfile;
...@@ -259,7 +259,7 @@ HRESULT ColorContext_Create(IWICColorContext **colorcontext) ...@@ -259,7 +259,7 @@ HRESULT ColorContext_Create(IWICColorContext **colorcontext)
if (!colorcontext) return E_INVALIDARG; if (!colorcontext) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorContext)); This = malloc(sizeof(ColorContext));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICColorContext_iface.lpVtbl = &ColorContext_Vtbl; This->IWICColorContext_iface.lpVtbl = &ColorContext_Vtbl;
......
...@@ -85,7 +85,7 @@ static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface) ...@@ -85,7 +85,7 @@ static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface)
if (ref == 0) if (ref == 0)
{ {
if (This->dst) IWICBitmapSource_Release(This->dst); if (This->dst) IWICBitmapSource_Release(This->dst);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -175,7 +175,7 @@ HRESULT ColorTransform_Create(IWICColorTransform **colortransform) ...@@ -175,7 +175,7 @@ HRESULT ColorTransform_Create(IWICColorTransform **colortransform)
if (!colortransform) return E_INVALIDARG; if (!colortransform) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ColorTransform)); This = malloc(sizeof(ColorTransform));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl; This->IWICColorTransform_iface.lpVtbl = &ColorTransform_Vtbl;
......
...@@ -793,9 +793,9 @@ static ULONG WINAPI DdsFrameDecode_Release(IWICBitmapFrameDecode *iface) ...@@ -793,9 +793,9 @@ static ULONG WINAPI DdsFrameDecode_Release(IWICBitmapFrameDecode *iface)
TRACE("(%p) refcount=%lu\n", iface, ref); TRACE("(%p) refcount=%lu\n", iface, ref);
if (ref == 0) { if (ref == 0) {
if (This->pixel_data != This->block_data) HeapFree(GetProcessHeap(), 0, This->pixel_data); if (This->pixel_data != This->block_data) free(This->pixel_data);
HeapFree(GetProcessHeap(), 0, This->block_data); free(This->block_data);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -884,7 +884,7 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, ...@@ -884,7 +884,7 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
if (!This->pixel_data) { if (!This->pixel_data) {
if (is_compressed(This->info.format)) { if (is_compressed(This->info.format)) {
This->pixel_data = HeapAlloc(GetProcessHeap(), 0, frame_size); This->pixel_data = malloc(frame_size);
if (!This->pixel_data) { if (!This->pixel_data) {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto end; goto end;
...@@ -1045,7 +1045,7 @@ static HRESULT DdsFrameDecode_CreateInstance(DdsFrameDecode **frame_decode) ...@@ -1045,7 +1045,7 @@ static HRESULT DdsFrameDecode_CreateInstance(DdsFrameDecode **frame_decode)
{ {
DdsFrameDecode *result; DdsFrameDecode *result;
result = HeapAlloc(GetProcessHeap(), 0, sizeof(*result)); result = malloc(sizeof(*result));
if (!result) return E_OUTOFMEMORY; if (!result) return E_OUTOFMEMORY;
result->IWICBitmapFrameDecode_iface.lpVtbl = &DdsFrameDecode_Vtbl; result->IWICBitmapFrameDecode_iface.lpVtbl = &DdsFrameDecode_Vtbl;
...@@ -1104,7 +1104,7 @@ static ULONG WINAPI DdsDecoder_Release(IWICBitmapDecoder *iface) ...@@ -1104,7 +1104,7 @@ static ULONG WINAPI DdsDecoder_Release(IWICBitmapDecoder *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1403,7 +1403,7 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface, ...@@ -1403,7 +1403,7 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface,
frame_decode->info.height_in_blocks = frame_height_in_blocks; frame_decode->info.height_in_blocks = frame_height_in_blocks;
frame_decode->info.pixel_format = This->info.pixel_format; frame_decode->info.pixel_format = This->info.pixel_format;
frame_decode->info.pixel_format_bpp = This->info.pixel_format_bpp; frame_decode->info.pixel_format_bpp = This->info.pixel_format_bpp;
frame_decode->block_data = HeapAlloc(GetProcessHeap(), 0, frame_size); frame_decode->block_data = malloc(frame_size);
frame_decode->pixel_data = NULL; frame_decode->pixel_data = NULL;
hr = IStream_Seek(This->stream, seek, SEEK_SET, NULL); hr = IStream_Seek(This->stream, seek, SEEK_SET, NULL);
if (hr != S_OK) goto end; if (hr != S_OK) goto end;
...@@ -1565,7 +1565,7 @@ static ULONG WINAPI DdsFrameEncode_Release(IWICBitmapFrameEncode *iface) ...@@ -1565,7 +1565,7 @@ static ULONG WINAPI DdsFrameEncode_Release(IWICBitmapFrameEncode *iface)
if (ref == 0) if (ref == 0)
{ {
IWICBitmapEncoder_Release(&This->parent->IWICBitmapEncoder_iface); IWICBitmapEncoder_Release(&This->parent->IWICBitmapEncoder_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1752,7 +1752,7 @@ HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv) ...@@ -1752,7 +1752,7 @@ HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(DdsDecoder)); This = malloc(sizeof(DdsDecoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &DdsDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &DdsDecoder_Vtbl;
...@@ -1884,7 +1884,7 @@ static HRESULT WINAPI DdsEncoder_Dds_CreateNewFrame(IWICDdsEncoder *iface, ...@@ -1884,7 +1884,7 @@ static HRESULT WINAPI DdsEncoder_Dds_CreateNewFrame(IWICDdsEncoder *iface,
goto end; goto end;
} }
result = HeapAlloc(GetProcessHeap(), 0, sizeof(*result)); result = malloc(sizeof(*result));
if (!result) if (!result)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -1966,7 +1966,7 @@ static ULONG WINAPI DdsEncoder_Release(IWICBitmapEncoder *iface) ...@@ -1966,7 +1966,7 @@ static ULONG WINAPI DdsEncoder_Release(IWICBitmapEncoder *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -2129,7 +2129,7 @@ HRESULT DdsEncoder_CreateInstance( REFIID iid, void **ppv) ...@@ -2129,7 +2129,7 @@ HRESULT DdsEncoder_CreateInstance( REFIID iid, void **ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(DdsEncoder)); This = malloc(sizeof(DdsEncoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapEncoder_iface.lpVtbl = &DdsEncoder_Vtbl; This->IWICBitmapEncoder_iface.lpVtbl = &DdsEncoder_Vtbl;
......
...@@ -92,7 +92,7 @@ static ULONG WINAPI CommonDecoder_Release(IWICBitmapDecoder *iface) ...@@ -92,7 +92,7 @@ static ULONG WINAPI CommonDecoder_Release(IWICBitmapDecoder *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
decoder_destroy(This->decoder); decoder_destroy(This->decoder);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -310,8 +310,8 @@ static ULONG WINAPI CommonDecoderFrame_Release(IWICBitmapFrameDecode *iface) ...@@ -310,8 +310,8 @@ static ULONG WINAPI CommonDecoderFrame_Release(IWICBitmapFrameDecode *iface)
if (ref == 0) if (ref == 0)
{ {
IWICBitmapDecoder_Release(&This->parent->IWICBitmapDecoder_iface); IWICBitmapDecoder_Release(&This->parent->IWICBitmapDecoder_iface);
HeapFree(GetProcessHeap(), 0, This->metadata_blocks); free(This->metadata_blocks);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -493,7 +493,7 @@ static HRESULT WINAPI CommonDecoderFrame_GetColorContexts(IWICBitmapFrameDecode ...@@ -493,7 +493,7 @@ static HRESULT WINAPI CommonDecoderFrame_GetColorContexts(IWICBitmapFrameDecode
{ {
hr = IWICColorContext_InitializeFromMemory(ppIColorContexts[i], profile, profile_len); hr = IWICColorContext_InitializeFromMemory(ppIColorContexts[i], profile, profile_len);
HeapFree(GetProcessHeap(), 0, profile); free(profile);
} }
if (FAILED(hr)) if (FAILED(hr))
...@@ -732,7 +732,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface, ...@@ -732,7 +732,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface,
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
result = HeapAlloc(GetProcessHeap(), 0, sizeof(*result)); result = malloc(sizeof(*result));
if (!result) if (!result)
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
} }
...@@ -754,7 +754,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface, ...@@ -754,7 +754,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface,
hr = CommonDecoderFrame_InitializeMetadata(result); hr = CommonDecoderFrame_InitializeMetadata(result);
if (FAILED(hr)) if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, result); free(result);
} }
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
...@@ -785,7 +785,7 @@ HRESULT CommonDecoder_CreateInstance(struct decoder *decoder, ...@@ -785,7 +785,7 @@ HRESULT CommonDecoder_CreateInstance(struct decoder *decoder,
TRACE("(%s,%s,%p)\n", debugstr_guid(&decoder_info->clsid), debugstr_guid(iid), ppv); TRACE("(%s,%s,%p)\n", debugstr_guid(&decoder_info->clsid), debugstr_guid(iid), ppv);
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) if (!This)
{ {
decoder_destroy(decoder); decoder_destroy(decoder);
......
...@@ -130,7 +130,7 @@ static ULONG WINAPI CommonEncoderFrame_Release(IWICBitmapFrameEncode *iface) ...@@ -130,7 +130,7 @@ static ULONG WINAPI CommonEncoderFrame_Release(IWICBitmapFrameEncode *iface)
if (ref == 0) if (ref == 0)
{ {
IWICBitmapEncoder_Release(&This->parent->IWICBitmapEncoder_iface); IWICBitmapEncoder_Release(&This->parent->IWICBitmapEncoder_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -546,7 +546,7 @@ static ULONG WINAPI CommonEncoder_Release(IWICBitmapEncoder *iface) ...@@ -546,7 +546,7 @@ static ULONG WINAPI CommonEncoder_Release(IWICBitmapEncoder *iface)
if (This->stream) if (This->stream)
IStream_Release(This->stream); IStream_Release(This->stream);
encoder_destroy(This->encoder); encoder_destroy(This->encoder);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -779,7 +779,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -779,7 +779,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED; return WINCODEC_ERR_NOTINITIALIZED;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*result)); result = calloc(1, sizeof(*result));
if (!result) if (!result)
{ {
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
...@@ -802,7 +802,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -802,7 +802,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (FAILED(hr)) if (FAILED(hr))
{ {
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, result); free(result);
return hr; return hr;
} }
} }
...@@ -874,7 +874,7 @@ HRESULT CommonEncoder_CreateInstance(struct encoder *encoder, ...@@ -874,7 +874,7 @@ HRESULT CommonEncoder_CreateInstance(struct encoder *encoder,
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(CommonEncoder)); This = malloc(sizeof(CommonEncoder));
if (!This) if (!This)
{ {
encoder_destroy(encoder); encoder_destroy(encoder);
......
...@@ -91,7 +91,7 @@ static ULONG WINAPI FlipRotator_Release(IWICBitmapFlipRotator *iface) ...@@ -91,7 +91,7 @@ static ULONG WINAPI FlipRotator_Release(IWICBitmapFlipRotator *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->source) IWICBitmapSource_Release(This->source); if (This->source) IWICBitmapSource_Release(This->source);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -267,7 +267,7 @@ HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) ...@@ -267,7 +267,7 @@ HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
{ {
FlipRotator *This; FlipRotator *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FlipRotator)); This = malloc(sizeof(FlipRotator));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapFlipRotator_iface.lpVtbl = &FlipRotator_Vtbl; This->IWICBitmapFlipRotator_iface.lpVtbl = &FlipRotator_Vtbl;
......
...@@ -81,7 +81,7 @@ static HRESULT load_LSD_metadata(IStream *stream, const GUID *vendor, DWORD opti ...@@ -81,7 +81,7 @@ static HRESULT load_LSD_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr = IStream_Read(stream, &lsd_data, sizeof(lsd_data), &bytesread); hr = IStream_Read(stream, &lsd_data, sizeof(lsd_data), &bytesread);
if (FAILED(hr) || bytesread != sizeof(lsd_data)) return S_OK; if (FAILED(hr) || bytesread != sizeof(lsd_data)) return S_OK;
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem) * 9); result = calloc(9, sizeof(MetadataItem));
if (!result) return E_OUTOFMEMORY; if (!result) return E_OUTOFMEMORY;
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
...@@ -169,7 +169,7 @@ static HRESULT load_IMD_metadata(IStream *stream, const GUID *vendor, DWORD opti ...@@ -169,7 +169,7 @@ static HRESULT load_IMD_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr = IStream_Read(stream, &imd_data, sizeof(imd_data), &bytesread); hr = IStream_Read(stream, &imd_data, sizeof(imd_data), &bytesread);
if (FAILED(hr) || bytesread != sizeof(imd_data)) return S_OK; if (FAILED(hr) || bytesread != sizeof(imd_data)) return S_OK;
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem) * 8); result = calloc(8, sizeof(MetadataItem));
if (!result) return E_OUTOFMEMORY; if (!result) return E_OUTOFMEMORY;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
...@@ -262,7 +262,7 @@ static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD opti ...@@ -262,7 +262,7 @@ static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr = IStream_Read(stream, &gce_data, sizeof(gce_data), &bytesread); hr = IStream_Read(stream, &gce_data, sizeof(gce_data), &bytesread);
if (FAILED(hr) || bytesread != sizeof(gce_data)) return S_OK; if (FAILED(hr) || bytesread != sizeof(gce_data)) return S_OK;
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem) * 5); result = calloc(5, sizeof(MetadataItem));
if (!result) return E_OUTOFMEMORY; if (!result) return E_OUTOFMEMORY;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
...@@ -377,7 +377,7 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti ...@@ -377,7 +377,7 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti
data_size += subblock_size + 1; data_size += subblock_size + 1;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem) * 2); result = calloc(2, sizeof(MetadataItem));
if (!result) if (!result)
{ {
CoTaskMemFree(data); CoTaskMemFree(data);
...@@ -482,7 +482,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO ...@@ -482,7 +482,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
data[data_size] = 0; data[data_size] = 0;
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); result = calloc(1, sizeof(MetadataItem));
if (!result) if (!result)
{ {
CoTaskMemFree(data); CoTaskMemFree(data);
...@@ -652,7 +652,7 @@ static ULONG WINAPI GifFrameDecode_Release(IWICBitmapFrameDecode *iface) ...@@ -652,7 +652,7 @@ static ULONG WINAPI GifFrameDecode_Release(IWICBitmapFrameDecode *iface)
if (ref == 0) if (ref == 0)
{ {
IWICBitmapDecoder_Release(&This->parent->IWICBitmapDecoder_iface); IWICBitmapDecoder_Release(&This->parent->IWICBitmapDecoder_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1072,7 +1072,7 @@ static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface) ...@@ -1072,7 +1072,7 @@ static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface)
} }
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1267,7 +1267,7 @@ static HRESULT WINAPI GifDecoder_GetFrame(IWICBitmapDecoder *iface, ...@@ -1267,7 +1267,7 @@ static HRESULT WINAPI GifDecoder_GetFrame(IWICBitmapDecoder *iface,
if (index >= This->gif->ImageCount) return E_INVALIDARG; if (index >= This->gif->ImageCount) return E_INVALIDARG;
result = HeapAlloc(GetProcessHeap(), 0, sizeof(GifFrameDecode)); result = malloc(sizeof(GifFrameDecode));
if (!result) return E_OUTOFMEMORY; if (!result) return E_OUTOFMEMORY;
result->IWICBitmapFrameDecode_iface.lpVtbl = &GifFrameDecode_Vtbl; result->IWICBitmapFrameDecode_iface.lpVtbl = &GifFrameDecode_Vtbl;
...@@ -1405,7 +1405,7 @@ HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv) ...@@ -1405,7 +1405,7 @@ HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(GifDecoder)); This = malloc(sizeof(GifDecoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &GifDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &GifDecoder_Vtbl;
...@@ -1511,8 +1511,8 @@ static ULONG WINAPI GifFrameEncode_Release(IWICBitmapFrameEncode *iface) ...@@ -1511,8 +1511,8 @@ static ULONG WINAPI GifFrameEncode_Release(IWICBitmapFrameEncode *iface)
if (!ref) if (!ref)
{ {
IWICBitmapEncoder_Release(&This->encoder->IWICBitmapEncoder_iface); IWICBitmapEncoder_Release(&This->encoder->IWICBitmapEncoder_iface);
HeapFree(GetProcessHeap(), 0, This->image_data); free(This->image_data);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1553,9 +1553,9 @@ static HRESULT WINAPI GifFrameEncode_SetSize(IWICBitmapFrameEncode *iface, UINT ...@@ -1553,9 +1553,9 @@ static HRESULT WINAPI GifFrameEncode_SetSize(IWICBitmapFrameEncode *iface, UINT
if (This->initialized) if (This->initialized)
{ {
HeapFree(GetProcessHeap(), 0, This->image_data); free(This->image_data);
This->image_data = HeapAlloc(GetProcessHeap(), 0, width * height); This->image_data = malloc(width * height);
if (This->image_data) if (This->image_data)
{ {
This->width = width; This->width = width;
...@@ -2158,7 +2158,7 @@ static ULONG WINAPI GifEncoder_Release(IWICBitmapEncoder *iface) ...@@ -2158,7 +2158,7 @@ static ULONG WINAPI GifEncoder_Release(IWICBitmapEncoder *iface)
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -2370,7 +2370,7 @@ static HRESULT WINAPI GifEncoder_CreateNewFrame(IWICBitmapEncoder *iface, IWICBi ...@@ -2370,7 +2370,7 @@ static HRESULT WINAPI GifEncoder_CreateNewFrame(IWICBitmapEncoder *iface, IWICBi
if (This->initialized && !This->committed) if (This->initialized && !This->committed)
{ {
GifFrameEncode *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); GifFrameEncode *ret = malloc(sizeof(*ret));
if (ret) if (ret)
{ {
This->n_frames++; This->n_frames++;
...@@ -2475,7 +2475,7 @@ HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv) ...@@ -2475,7 +2475,7 @@ HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapEncoder_iface.lpVtbl = &GifEncoder_Vtbl; This->IWICBitmapEncoder_iface.lpVtbl = &GifEncoder_Vtbl;
......
...@@ -123,8 +123,8 @@ static ULONG WINAPI IcoFrameDecode_Release(IWICBitmapFrameDecode *iface) ...@@ -123,8 +123,8 @@ static ULONG WINAPI IcoFrameDecode_Release(IWICBitmapFrameDecode *iface)
if (ref == 0) if (ref == 0)
{ {
HeapFree(GetProcessHeap(), 0, This->bits); free(This->bits);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -247,7 +247,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) ...@@ -247,7 +247,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
result->bits = HeapAlloc(GetProcessHeap(), 0, result->width * result->height * 4); result->bits = malloc(result->width * result->height * 4);
if (!result->bits) hr = E_OUTOFMEMORY; if (!result->bits) hr = E_OUTOFMEMORY;
} }
...@@ -336,7 +336,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) ...@@ -336,7 +336,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
tempdata = HeapAlloc(GetProcessHeap(), 0, andBytes); tempdata = malloc(andBytes);
if (!tempdata) hr = E_OUTOFMEMORY; if (!tempdata) hr = E_OUTOFMEMORY;
} }
...@@ -376,7 +376,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) ...@@ -376,7 +376,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
} }
} }
HeapFree(GetProcessHeap(), 0, tempdata); free(tempdata);
} }
} }
...@@ -412,7 +412,7 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result) ...@@ -412,7 +412,7 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result)
hr = IWICBitmapFrameDecode_GetResolution(sourceFrame, &result->dpiX, &result->dpiY); hr = IWICBitmapFrameDecode_GetResolution(sourceFrame, &result->dpiX, &result->dpiY);
if (FAILED(hr)) if (FAILED(hr))
goto end; goto end;
result->bits = HeapAlloc(GetProcessHeap(), 0, 4 * result->width * result->height); result->bits = malloc(4 * result->width * result->height);
if (result->bits == NULL) if (result->bits == NULL)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -480,7 +480,7 @@ static ULONG WINAPI IcoDecoder_Release(IWICBitmapDecoder *iface) ...@@ -480,7 +480,7 @@ static ULONG WINAPI IcoDecoder_Release(IWICBitmapDecoder *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->stream) IStream_Release(This->stream); if (This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -668,7 +668,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface, ...@@ -668,7 +668,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface,
goto fail; goto fail;
} }
result = HeapAlloc(GetProcessHeap(), 0, sizeof(IcoFrameDecode)); result = malloc(sizeof(IcoFrameDecode));
if (!result) if (!result)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -730,7 +730,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface, ...@@ -730,7 +730,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface,
fail: fail:
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, result); free(result);
if (substream) IWICStream_Release(substream); if (substream) IWICStream_Release(substream);
if (SUCCEEDED(hr)) hr = E_FAIL; if (SUCCEEDED(hr)) hr = E_FAIL;
TRACE("<-- %lx\n", hr); TRACE("<-- %lx\n", hr);
...@@ -763,7 +763,7 @@ HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) ...@@ -763,7 +763,7 @@ HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcoDecoder)); This = malloc(sizeof(IcoDecoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &IcoDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &IcoDecoder_Vtbl;
......
...@@ -96,7 +96,7 @@ static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory2 *iface) ...@@ -96,7 +96,7 @@ static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory2 *iface)
TRACE("(%p) refcount=%lu\n", iface, ref); TRACE("(%p) refcount=%lu\n", iface, ref);
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -924,7 +924,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 * ...@@ -924,7 +924,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *
{ {
BYTE *mask; BYTE *mask;
mask = HeapAlloc(GetProcessHeap(), 0, size); mask = malloc(size);
if (!mask) if (!mask)
{ {
IWICBitmapLock_Release(lock); IWICBitmapLock_Release(lock);
...@@ -951,7 +951,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 * ...@@ -951,7 +951,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *
} }
} }
HeapFree(GetProcessHeap(), 0, mask); free(mask);
} }
else else
{ {
...@@ -1470,7 +1470,7 @@ HRESULT ImagingFactory_CreateInstance(REFIID iid, void** ppv) ...@@ -1470,7 +1470,7 @@ HRESULT ImagingFactory_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl; This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/rbtree.h" #include "wine/rbtree.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
...@@ -247,8 +246,8 @@ static ULONG WINAPI BitmapDecoderInfo_Release(IWICBitmapDecoderInfo *iface) ...@@ -247,8 +246,8 @@ static ULONG WINAPI BitmapDecoderInfo_Release(IWICBitmapDecoderInfo *iface)
if (ref == 0) if (ref == 0)
{ {
RegCloseKey(This->classkey); RegCloseKey(This->classkey);
heap_free(This->patterns); free(This->patterns);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -465,9 +464,9 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if ...@@ -465,9 +464,9 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if
{ {
if (datasize < This->patterns[i].Length) if (datasize < This->patterns[i].Length)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
datasize = This->patterns[i].Length; datasize = This->patterns[i].Length;
data = HeapAlloc(GetProcessHeap(), 0, This->patterns[i].Length); data = malloc(This->patterns[i].Length);
if (!data) if (!data)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -507,7 +506,7 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if ...@@ -507,7 +506,7 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if
*pfMatches = FALSE; *pfMatches = FALSE;
} }
HeapFree(GetProcessHeap(), 0, data); free(data);
return hr; return hr;
} }
...@@ -573,7 +572,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) ...@@ -573,7 +572,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
} }
patterns_size = pattern_count * sizeof(WICBitmapPattern); patterns_size = pattern_count * sizeof(WICBitmapPattern);
patterns = heap_alloc(patterns_size); patterns = malloc(patterns_size);
if (!patterns) if (!patterns)
{ {
RegCloseKey(patternskey); RegCloseKey(patternskey);
...@@ -607,9 +606,9 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) ...@@ -607,9 +606,9 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
RegCloseKey(patternkey); RegCloseKey(patternkey);
} }
if (res != ERROR_SUCCESS || !(patterns_ptr = heap_realloc(patterns, patterns_size))) if (res != ERROR_SUCCESS || !(patterns_ptr = realloc(patterns, patterns_size)))
{ {
heap_free(patterns); free(patterns);
RegCloseKey(patternskey); RegCloseKey(patternskey);
return; return;
} }
...@@ -645,7 +644,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info) ...@@ -645,7 +644,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
{ {
heap_free(patterns); free(patterns);
return; return;
} }
...@@ -658,7 +657,7 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp ...@@ -658,7 +657,7 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
{ {
BitmapDecoderInfo *This; BitmapDecoderInfo *This;
This = heap_alloc_zero(sizeof(BitmapDecoderInfo)); This = calloc(1, sizeof(BitmapDecoderInfo));
if (!This) if (!This)
{ {
RegCloseKey(classkey); RegCloseKey(classkey);
...@@ -731,7 +730,7 @@ static ULONG WINAPI BitmapEncoderInfo_Release(IWICBitmapEncoderInfo *iface) ...@@ -731,7 +730,7 @@ static ULONG WINAPI BitmapEncoderInfo_Release(IWICBitmapEncoderInfo *iface)
if (ref == 0) if (ref == 0)
{ {
RegCloseKey(This->classkey); RegCloseKey(This->classkey);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -951,7 +950,7 @@ static HRESULT BitmapEncoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp ...@@ -951,7 +950,7 @@ static HRESULT BitmapEncoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
{ {
BitmapEncoderInfo *This; BitmapEncoderInfo *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapEncoderInfo)); This = malloc(sizeof(BitmapEncoderInfo));
if (!This) if (!This)
{ {
RegCloseKey(classkey); RegCloseKey(classkey);
...@@ -1021,7 +1020,7 @@ static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface) ...@@ -1021,7 +1020,7 @@ static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface)
if (ref == 0) if (ref == 0)
{ {
RegCloseKey(This->classkey); RegCloseKey(This->classkey);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1164,7 +1163,7 @@ static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, Co ...@@ -1164,7 +1163,7 @@ static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, Co
{ {
FormatConverterInfo *This; FormatConverterInfo *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverterInfo)); This = malloc(sizeof(FormatConverterInfo));
if (!This) if (!This)
{ {
RegCloseKey(classkey); RegCloseKey(classkey);
...@@ -1235,7 +1234,7 @@ static ULONG WINAPI PixelFormatInfo_Release(IWICPixelFormatInfo2 *iface) ...@@ -1235,7 +1234,7 @@ static ULONG WINAPI PixelFormatInfo_Release(IWICPixelFormatInfo2 *iface)
if (ref == 0) if (ref == 0)
{ {
RegCloseKey(This->classkey); RegCloseKey(This->classkey);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -1452,7 +1451,7 @@ static HRESULT PixelFormatInfo_Constructor(HKEY classkey, REFCLSID clsid, Compon ...@@ -1452,7 +1451,7 @@ static HRESULT PixelFormatInfo_Constructor(HKEY classkey, REFCLSID clsid, Compon
{ {
PixelFormatInfo *This; PixelFormatInfo *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(PixelFormatInfo)); This = malloc(sizeof(PixelFormatInfo));
if (!This) if (!This)
{ {
RegCloseKey(classkey); RegCloseKey(classkey);
...@@ -1547,10 +1546,10 @@ static ULONG WINAPI MetadataReaderInfo_Release(IWICMetadataReaderInfo *iface) ...@@ -1547,10 +1546,10 @@ static ULONG WINAPI MetadataReaderInfo_Release(IWICMetadataReaderInfo *iface)
unsigned i; unsigned i;
RegCloseKey(This->classkey); RegCloseKey(This->classkey);
for (i = 0; i < This->container_count; i++) for (i = 0; i < This->container_count; i++)
heap_free(This->containers[i].patterns); free(This->containers[i].patterns);
heap_free(This->containers); free(This->containers);
heap_free(This->container_formats); free(This->container_formats);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -1747,9 +1746,9 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo * ...@@ -1747,9 +1746,9 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *
{ {
if (datasize < container->patterns[i].Length) if (datasize < container->patterns[i].Length)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
datasize = container->patterns[i].Length; datasize = container->patterns[i].Length;
data = HeapAlloc(GetProcessHeap(), 0, container->patterns[i].Length); data = malloc(container->patterns[i].Length);
if (!data) if (!data)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -1785,7 +1784,7 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo * ...@@ -1785,7 +1784,7 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *
*matches = FALSE; *matches = FALSE;
} }
HeapFree(GetProcessHeap(), 0, data); free(data);
return hr; return hr;
} }
...@@ -1854,7 +1853,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui ...@@ -1854,7 +1853,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
} }
patterns_size = pattern_count * sizeof(WICMetadataPattern); patterns_size = pattern_count * sizeof(WICMetadataPattern);
patterns = heap_alloc(patterns_size); patterns = malloc(patterns_size);
if (!patterns) if (!patterns)
{ {
RegCloseKey(guid_key); RegCloseKey(guid_key);
...@@ -1887,9 +1886,9 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui ...@@ -1887,9 +1886,9 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
RegCloseKey(patternkey); RegCloseKey(patternkey);
} }
if (res != ERROR_SUCCESS || !(patterns_ptr = heap_realloc(patterns, patterns_size))) if (res != ERROR_SUCCESS || !(patterns_ptr = realloc(patterns, patterns_size)))
{ {
heap_free(patterns); free(patterns);
RegCloseKey(guid_key); RegCloseKey(guid_key);
return; return;
} }
...@@ -1925,7 +1924,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui ...@@ -1925,7 +1924,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
{ {
heap_free(patterns); free(patterns);
return; return;
} }
...@@ -1943,14 +1942,14 @@ static BOOL read_metadata_info(MetadataReaderInfo *info) ...@@ -1943,14 +1942,14 @@ static BOOL read_metadata_info(MetadataReaderInfo *info)
hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", 0, NULL, &format_count); hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", 0, NULL, &format_count);
if (FAILED(hr)) return TRUE; if (FAILED(hr)) return TRUE;
formats = heap_calloc(format_count, sizeof(*formats)); formats = calloc(format_count, sizeof(*formats));
if (!formats) return FALSE; if (!formats) return FALSE;
hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", format_count, formats, hr = ComponentInfo_GetGuidList(info->classkey, L"Containers", format_count, formats,
&format_count); &format_count);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(formats); free(formats);
return FALSE; return FALSE;
} }
...@@ -1961,7 +1960,7 @@ static BOOL read_metadata_info(MetadataReaderInfo *info) ...@@ -1961,7 +1960,7 @@ static BOOL read_metadata_info(MetadataReaderInfo *info)
{ {
unsigned i; unsigned i;
info->containers = heap_calloc(format_count, sizeof(*info->containers)); info->containers = calloc(format_count, sizeof(*info->containers));
if (!info->containers) return FALSE; if (!info->containers) return FALSE;
for (i = 0; i < format_count; i++) for (i = 0; i < format_count; i++)
...@@ -1975,7 +1974,7 @@ static HRESULT MetadataReaderInfo_Constructor(HKEY classkey, REFCLSID clsid, Com ...@@ -1975,7 +1974,7 @@ static HRESULT MetadataReaderInfo_Constructor(HKEY classkey, REFCLSID clsid, Com
{ {
MetadataReaderInfo *This; MetadataReaderInfo *This;
This = heap_alloc_zero(sizeof(*This)); This = calloc(1, sizeof(*This));
if (!This) if (!This)
{ {
RegCloseKey(classkey); RegCloseKey(classkey);
...@@ -2199,11 +2198,11 @@ static ULONG WINAPI ComponentEnum_Release(IEnumUnknown *iface) ...@@ -2199,11 +2198,11 @@ static ULONG WINAPI ComponentEnum_Release(IEnumUnknown *iface)
{ {
IUnknown_Release(cursor->unk); IUnknown_Release(cursor->unk);
list_remove(&cursor->entry); list_remove(&cursor->entry);
HeapFree(GetProcessHeap(), 0, cursor); free(cursor);
} }
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -2281,7 +2280,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp ...@@ -2281,7 +2280,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp
HRESULT ret=S_OK; HRESULT ret=S_OK;
struct list *old_cursor; struct list *old_cursor;
new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnum)); new_enum = malloc(sizeof(ComponentEnum));
if (!new_enum) if (!new_enum)
{ {
*ppenum = NULL; *ppenum = NULL;
...@@ -2301,7 +2300,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp ...@@ -2301,7 +2300,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp
LIST_FOR_EACH_ENTRY(old_item, &This->objects, ComponentEnumItem, entry) LIST_FOR_EACH_ENTRY(old_item, &This->objects, ComponentEnumItem, entry)
{ {
new_item = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnumItem)); new_item = malloc(sizeof(ComponentEnumItem));
if (!new_item) if (!new_item)
{ {
ret = E_OUTOFMEMORY; ret = E_OUTOFMEMORY;
...@@ -2352,7 +2351,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn ...@@ -2352,7 +2351,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
if (res != ERROR_SUCCESS) if (res != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(res); return HRESULT_FROM_WIN32(res);
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnum)); This = malloc(sizeof(ComponentEnum));
if (!This) if (!This)
{ {
RegCloseKey(clsidkey); RegCloseKey(clsidkey);
...@@ -2382,7 +2381,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn ...@@ -2382,7 +2381,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
res = RegEnumKeyExW(instancekey, i, guidstring, &guidstring_size, NULL, NULL, NULL, NULL); res = RegEnumKeyExW(instancekey, i, guidstring, &guidstring_size, NULL, NULL, NULL, NULL);
if (res != ERROR_SUCCESS) break; if (res != ERROR_SUCCESS) break;
item = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnumItem)); item = malloc(sizeof(ComponentEnumItem));
if (!item) { hr = E_OUTOFMEMORY; break; } if (!item) { hr = E_OUTOFMEMORY; break; }
hr = CLSIDFromString(guidstring, &clsid); hr = CLSIDFromString(guidstring, &clsid);
...@@ -2395,7 +2394,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn ...@@ -2395,7 +2394,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
if (FAILED(hr)) if (FAILED(hr))
{ {
HeapFree(GetProcessHeap(), 0, item); free(item);
hr = S_OK; hr = S_OK;
} }
} }
......
...@@ -98,7 +98,7 @@ static void CDECL jpeg_decoder_destroy(struct decoder* iface) ...@@ -98,7 +98,7 @@ static void CDECL jpeg_decoder_destroy(struct decoder* iface)
if (This->cinfo_initialized) jpeg_destroy_decompress(&This->cinfo); if (This->cinfo_initialized) jpeg_destroy_decompress(&This->cinfo);
free(This->image_data); free(This->image_data);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
} }
static void source_mgr_init_source(j_decompress_ptr cinfo) static void source_mgr_init_source(j_decompress_ptr cinfo)
...@@ -340,7 +340,7 @@ HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **re ...@@ -340,7 +340,7 @@ HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **re
{ {
struct jpeg_decoder *This; struct jpeg_decoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(struct jpeg_decoder)); This = malloc(sizeof(struct jpeg_decoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->decoder.vtable = &jpeg_decoder_vtable; This->decoder.vtable = &jpeg_decoder_vtable;
...@@ -618,7 +618,7 @@ static void CDECL jpeg_encoder_destroy(struct encoder* iface) ...@@ -618,7 +618,7 @@ static void CDECL jpeg_encoder_destroy(struct encoder* iface)
struct jpeg_encoder *This = impl_from_encoder(iface); struct jpeg_encoder *This = impl_from_encoder(iface);
if (This->cinfo_initialized) if (This->cinfo_initialized)
jpeg_destroy_compress(&This->cinfo); jpeg_destroy_compress(&This->cinfo);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
}; };
static const struct encoder_funcs jpeg_encoder_vtable = { static const struct encoder_funcs jpeg_encoder_vtable = {
...@@ -635,7 +635,7 @@ HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **re ...@@ -635,7 +635,7 @@ HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **re
{ {
struct jpeg_encoder *This; struct jpeg_encoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(struct jpeg_encoder)); This = malloc(sizeof(struct jpeg_encoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->encoder.vtable = &jpeg_encoder_vtable; This->encoder.vtable = &jpeg_encoder_vtable;
......
...@@ -392,8 +392,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface, ...@@ -392,8 +392,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface,
ULONG new_metadata_blocks_size; ULONG new_metadata_blocks_size;
new_metadata_blocks_size = 4 + metadata_blocks_size * 2; new_metadata_blocks_size = 4 + metadata_blocks_size * 2;
new_metadata_blocks = RtlAllocateHeap(GetProcessHeap(), 0, new_metadata_blocks = malloc(new_metadata_blocks_size * sizeof(*new_metadata_blocks));
new_metadata_blocks_size * sizeof(*new_metadata_blocks));
if (!new_metadata_blocks) if (!new_metadata_blocks)
{ {
...@@ -404,7 +403,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface, ...@@ -404,7 +403,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface,
memcpy(new_metadata_blocks, result, memcpy(new_metadata_blocks, result,
*count * sizeof(*new_metadata_blocks)); *count * sizeof(*new_metadata_blocks));
RtlFreeHeap(GetProcessHeap(), 0, result); free(result);
result = new_metadata_blocks; result = new_metadata_blocks;
metadata_blocks_size = new_metadata_blocks_size; metadata_blocks_size = new_metadata_blocks_size;
} }
...@@ -427,7 +426,7 @@ end: ...@@ -427,7 +426,7 @@ end:
{ {
*count = 0; *count = 0;
*blocks = NULL; *blocks = NULL;
RtlFreeHeap(GetProcessHeap(), 0, result); free(result);
} }
return hr; return hr;
} }
...@@ -437,7 +436,7 @@ static HRESULT CDECL png_decoder_get_color_context(struct decoder* iface, UINT f ...@@ -437,7 +436,7 @@ static HRESULT CDECL png_decoder_get_color_context(struct decoder* iface, UINT f
{ {
struct png_decoder *This = impl_from_decoder(iface); struct png_decoder *This = impl_from_decoder(iface);
*data = RtlAllocateHeap(GetProcessHeap(), 0, This->color_profile_len); *data = malloc(This->color_profile_len);
*datasize = This->color_profile_len; *datasize = This->color_profile_len;
if (!*data) if (!*data)
...@@ -454,7 +453,7 @@ static void CDECL png_decoder_destroy(struct decoder* iface) ...@@ -454,7 +453,7 @@ static void CDECL png_decoder_destroy(struct decoder* iface)
free(This->image_bits); free(This->image_bits);
free(This->color_profile); free(This->color_profile);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
} }
static const struct decoder_funcs png_decoder_vtable = { static const struct decoder_funcs png_decoder_vtable = {
...@@ -470,7 +469,7 @@ HRESULT CDECL png_decoder_create(struct decoder_info *info, struct decoder **res ...@@ -470,7 +469,7 @@ HRESULT CDECL png_decoder_create(struct decoder_info *info, struct decoder **res
{ {
struct png_decoder *This; struct png_decoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) if (!This)
{ {
...@@ -802,7 +801,7 @@ static void CDECL png_encoder_destroy(struct encoder *encoder) ...@@ -802,7 +801,7 @@ static void CDECL png_encoder_destroy(struct encoder *encoder)
if (This->png_ptr) if (This->png_ptr)
png_destroy_write_struct(&This->png_ptr, &This->info_ptr); png_destroy_write_struct(&This->png_ptr, &This->info_ptr);
free(This->data); free(This->data);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
} }
static const struct encoder_funcs png_encoder_vtable = { static const struct encoder_funcs png_encoder_vtable = {
...@@ -819,7 +818,7 @@ HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **res ...@@ -819,7 +818,7 @@ HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **res
{ {
struct png_encoder *This; struct png_encoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) if (!This)
{ {
......
...@@ -1017,7 +1017,7 @@ static HRESULT CDECL tiff_decoder_get_color_context(struct decoder *iface, ...@@ -1017,7 +1017,7 @@ static HRESULT CDECL tiff_decoder_get_color_context(struct decoder *iface,
} }
*datasize = len; *datasize = len;
*data = RtlAllocateHeap(GetProcessHeap(), 0, len); *data = malloc(len);
if (!*data) if (!*data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1052,7 +1052,7 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface, ...@@ -1052,7 +1052,7 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface,
result.options |= WICPersistOptionNoCacheStream|DECODER_BLOCK_FULL_STREAM|DECODER_BLOCK_READER_CLSID; result.options |= WICPersistOptionNoCacheStream|DECODER_BLOCK_FULL_STREAM|DECODER_BLOCK_READER_CLSID;
result.reader_clsid = CLSID_WICIfdMetadataReader; result.reader_clsid = CLSID_WICIfdMetadataReader;
*blocks = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(**blocks)); *blocks = malloc(sizeof(**blocks));
**blocks = result; **blocks = result;
return S_OK; return S_OK;
...@@ -1063,7 +1063,7 @@ static void CDECL tiff_decoder_destroy(struct decoder* iface) ...@@ -1063,7 +1063,7 @@ static void CDECL tiff_decoder_destroy(struct decoder* iface)
struct tiff_decoder *This = impl_from_decoder(iface); struct tiff_decoder *This = impl_from_decoder(iface);
if (This->tiff) TIFFClose(This->tiff); if (This->tiff) TIFFClose(This->tiff);
free(This->cached_tile); free(This->cached_tile);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
} }
static const struct decoder_funcs tiff_decoder_vtable = { static const struct decoder_funcs tiff_decoder_vtable = {
...@@ -1079,7 +1079,7 @@ HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **re ...@@ -1079,7 +1079,7 @@ HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **re
{ {
struct tiff_decoder *This; struct tiff_decoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->decoder.vtable = &tiff_decoder_vtable; This->decoder.vtable = &tiff_decoder_vtable;
...@@ -1300,7 +1300,7 @@ static void CDECL tiff_encoder_destroy(struct encoder* iface) ...@@ -1300,7 +1300,7 @@ static void CDECL tiff_encoder_destroy(struct encoder* iface)
struct tiff_encoder *This = impl_from_encoder(iface); struct tiff_encoder *This = impl_from_encoder(iface);
if (This->tiff) TIFFClose(This->tiff); if (This->tiff) TIFFClose(This->tiff);
RtlFreeHeap(GetProcessHeap(), 0, This); free(This);
} }
static const struct encoder_funcs tiff_encoder_vtable = { static const struct encoder_funcs tiff_encoder_vtable = {
...@@ -1317,7 +1317,7 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re ...@@ -1317,7 +1317,7 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re
{ {
struct tiff_encoder *This; struct tiff_encoder *This;
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This)); This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->encoder.vtable = &tiff_encoder_vtable; This->encoder.vtable = &tiff_encoder_vtable;
......
...@@ -64,7 +64,7 @@ static void MetadataHandler_FreeItems(MetadataHandler *This) ...@@ -64,7 +64,7 @@ static void MetadataHandler_FreeItems(MetadataHandler *This)
PropVariantClear(&This->items[i].value); PropVariantClear(&This->items[i].value);
} }
HeapFree(GetProcessHeap(), 0, This->items); free(This->items);
} }
static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index, static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index,
...@@ -122,7 +122,7 @@ static ULONG WINAPI MetadataHandler_Release(IWICMetadataWriter *iface) ...@@ -122,7 +122,7 @@ static ULONG WINAPI MetadataHandler_Release(IWICMetadataWriter *iface)
MetadataHandler_FreeItems(This); MetadataHandler_FreeItems(This);
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -400,7 +400,7 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, voi ...@@ -400,7 +400,7 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, voi
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetadataHandler)); This = malloc(sizeof(MetadataHandler));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICMetadataWriter_iface.lpVtbl = &MetadataHandler_Vtbl; This->IWICMetadataWriter_iface.lpVtbl = &MetadataHandler_Vtbl;
...@@ -475,7 +475,7 @@ static ULONG WINAPI MetadataHandlerEnum_Release(IWICEnumMetadataItem *iface) ...@@ -475,7 +475,7 @@ static ULONG WINAPI MetadataHandlerEnum_Release(IWICEnumMetadataItem *iface)
if (ref == 0) if (ref == 0)
{ {
IWICMetadataWriter_Release(&This->parent->IWICMetadataWriter_iface); IWICMetadataWriter_Release(&This->parent->IWICMetadataWriter_iface);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -594,7 +594,7 @@ static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index, ...@@ -594,7 +594,7 @@ static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index,
*ppIEnumMetadataItem = NULL; *ppIEnumMetadataItem = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetadataHandlerEnum)); This = malloc(sizeof(MetadataHandlerEnum));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
IWICMetadataWriter_AddRef(&parent->IWICMetadataWriter_iface); IWICMetadataWriter_AddRef(&parent->IWICMetadataWriter_iface);
...@@ -635,7 +635,7 @@ static HRESULT LoadUnknownMetadata(IStream *input, const GUID *preferred_vendor, ...@@ -635,7 +635,7 @@ static HRESULT LoadUnknownMetadata(IStream *input, const GUID *preferred_vendor,
return hr; return hr;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); result = calloc(1, sizeof(MetadataItem));
if (!result) if (!result)
{ {
CoTaskMemFree(data); CoTaskMemFree(data);
...@@ -1019,14 +1019,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor, ...@@ -1019,14 +1019,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
SWAP_USHORT(count); SWAP_USHORT(count);
entry = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*entry)); entry = malloc(count * sizeof(*entry));
if (!entry) return E_OUTOFMEMORY; if (!entry) return E_OUTOFMEMORY;
hr = IStream_Read(input, entry, count * sizeof(*entry), &bytesread); hr = IStream_Read(input, entry, count * sizeof(*entry), &bytesread);
if (bytesread != count * sizeof(*entry)) hr = E_FAIL; if (bytesread != count * sizeof(*entry)) hr = E_FAIL;
if (hr != S_OK) if (hr != S_OK)
{ {
HeapFree(GetProcessHeap(), 0, entry); free(entry);
return hr; return hr;
} }
...@@ -1061,14 +1061,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor, ...@@ -1061,14 +1061,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
if (hr != S_OK || i == 4096) if (hr != S_OK || i == 4096)
{ {
HeapFree(GetProcessHeap(), 0, entry); free(entry);
return WINCODEC_ERR_BADMETADATAHEADER; return WINCODEC_ERR_BADMETADATAHEADER;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * sizeof(*result)); result = calloc(count, sizeof(*result));
if (!result) if (!result)
{ {
HeapFree(GetProcessHeap(), 0, entry); free(entry);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -1077,13 +1077,13 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor, ...@@ -1077,13 +1077,13 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
hr = load_IFD_entry(input, &entry[i], &result[i], native_byte_order); hr = load_IFD_entry(input, &entry[i], &result[i], native_byte_order);
if (FAILED(hr)) if (FAILED(hr))
{ {
HeapFree(GetProcessHeap(), 0, entry); free(entry);
HeapFree(GetProcessHeap(), 0, result); free(result);
return hr; return hr;
} }
} }
HeapFree(GetProcessHeap(), 0, entry); free(entry);
*items = result; *items = result;
*item_count = count; *item_count = count;
......
...@@ -90,8 +90,8 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface) ...@@ -90,8 +90,8 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
{ {
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This->colors); free(This->colors);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -103,7 +103,7 @@ static WICColor *generate_gray16_palette(UINT *count) ...@@ -103,7 +103,7 @@ static WICColor *generate_gray16_palette(UINT *count)
UINT i; UINT i;
*count = 16; *count = 16;
entries = HeapAlloc(GetProcessHeap(), 0, 16 * sizeof(WICColor)); entries = malloc(16 * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
...@@ -120,7 +120,7 @@ static WICColor *generate_gray256_palette(UINT *count) ...@@ -120,7 +120,7 @@ static WICColor *generate_gray256_palette(UINT *count)
UINT i; UINT i;
*count = 256; *count = 256;
entries = HeapAlloc(GetProcessHeap(), 0, 256 * sizeof(WICColor)); entries = malloc(256 * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
...@@ -137,7 +137,7 @@ static WICColor *generate_halftone8_palette(UINT *count, BOOL add_transparent) ...@@ -137,7 +137,7 @@ static WICColor *generate_halftone8_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 17 : 16; *count = add_transparent ? 17 : 16;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
...@@ -168,7 +168,7 @@ static WICColor *generate_halftone27_palette(UINT *count, BOOL add_transparent) ...@@ -168,7 +168,7 @@ static WICColor *generate_halftone27_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 29 : 28; *count = add_transparent ? 29 : 28;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 27; i++) for (i = 0; i < 27; i++)
...@@ -193,7 +193,7 @@ static WICColor *generate_halftone64_palette(UINT *count, BOOL add_transparent) ...@@ -193,7 +193,7 @@ static WICColor *generate_halftone64_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 73 : 72; *count = add_transparent ? 73 : 72;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
...@@ -225,7 +225,7 @@ static WICColor *generate_halftone125_palette(UINT *count, BOOL add_transparent) ...@@ -225,7 +225,7 @@ static WICColor *generate_halftone125_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 127 : 126; *count = add_transparent ? 127 : 126;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 125; i++) for (i = 0; i < 125; i++)
...@@ -250,7 +250,7 @@ static WICColor *generate_halftone216_palette(UINT *count, BOOL add_transparent) ...@@ -250,7 +250,7 @@ static WICColor *generate_halftone216_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 225 : 224; *count = add_transparent ? 225 : 224;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 216; i++) for (i = 0; i < 216; i++)
...@@ -282,7 +282,7 @@ static WICColor *generate_halftone252_palette(UINT *count, BOOL add_transparent) ...@@ -282,7 +282,7 @@ static WICColor *generate_halftone252_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = add_transparent ? 253 : 252; *count = add_transparent ? 253 : 252;
entries = HeapAlloc(GetProcessHeap(), 0, *count * sizeof(WICColor)); entries = malloc(*count * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 252; i++) for (i = 0; i < 252; i++)
...@@ -307,7 +307,7 @@ static WICColor *generate_halftone256_palette(UINT *count, BOOL add_transparent) ...@@ -307,7 +307,7 @@ static WICColor *generate_halftone256_palette(UINT *count, BOOL add_transparent)
UINT i; UINT i;
*count = 256; *count = 256;
entries = HeapAlloc(GetProcessHeap(), 0, 256 * sizeof(WICColor)); entries = malloc(256 * sizeof(WICColor));
if (!entries) return NULL; if (!entries) return NULL;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
...@@ -339,7 +339,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface, ...@@ -339,7 +339,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
{ {
case WICBitmapPaletteTypeFixedBW: case WICBitmapPaletteTypeFixedBW:
count = 2; count = 2;
colors = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WICColor)); colors = malloc(count * sizeof(WICColor));
if (!colors) return E_OUTOFMEMORY; if (!colors) return E_OUTOFMEMORY;
colors[0] = 0xff000000; colors[0] = 0xff000000;
colors[1] = 0xffffffff; colors[1] = 0xffffffff;
...@@ -347,7 +347,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface, ...@@ -347,7 +347,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
case WICBitmapPaletteTypeFixedGray4: case WICBitmapPaletteTypeFixedGray4:
count = 4; count = 4;
colors = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WICColor)); colors = malloc(count * sizeof(WICColor));
if (!colors) return E_OUTOFMEMORY; if (!colors) return E_OUTOFMEMORY;
colors[0] = 0xff000000; colors[0] = 0xff000000;
colors[1] = 0xff555555; colors[1] = 0xff555555;
...@@ -406,7 +406,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface, ...@@ -406,7 +406,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
} }
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This->colors); free(This->colors);
This->colors = colors; This->colors = colors;
This->count = count; This->count = count;
This->type = type; This->type = type;
...@@ -430,13 +430,13 @@ static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface, ...@@ -430,13 +430,13 @@ static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface,
else else
{ {
if (!pColors) return E_INVALIDARG; if (!pColors) return E_INVALIDARG;
new_colors = HeapAlloc(GetProcessHeap(), 0, sizeof(WICColor) * colorCount); new_colors = malloc(sizeof(WICColor) * colorCount);
if (!new_colors) return E_OUTOFMEMORY; if (!new_colors) return E_OUTOFMEMORY;
memcpy(new_colors, pColors, sizeof(WICColor) * colorCount); memcpy(new_colors, pColors, sizeof(WICColor) * colorCount);
} }
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This->colors); free(This->colors);
This->colors = new_colors; This->colors = new_colors;
This->count = colorCount; This->count = colorCount;
This->type = WICBitmapPaletteTypeCustom; This->type = WICBitmapPaletteTypeCustom;
...@@ -612,7 +612,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei ...@@ -612,7 +612,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei
struct box *b1, *b2; struct box *b1, *b2;
int numboxes, i; int numboxes, i;
if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h)))) if (!(h = calloc(1, sizeof(*h))))
return 0; return 0;
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
...@@ -641,7 +641,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei ...@@ -641,7 +641,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei
for (i = 0; i < numboxes; i++) for (i = 0; i < numboxes; i++)
colors[i] = box_color(h, &boxes[i]); colors[i] = box_color(h, &boxes[i]);
HeapFree(GetProcessHeap(), 0, h); free(h);
return numboxes; return numboxes;
} }
...@@ -739,18 +739,18 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface, ...@@ -739,18 +739,18 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface,
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
if (count) if (count)
{ {
colors = HeapAlloc(GetProcessHeap(), 0, sizeof(WICColor) * count); colors = malloc(sizeof(WICColor) * count);
if (!colors) return E_OUTOFMEMORY; if (!colors) return E_OUTOFMEMORY;
hr = IWICPalette_GetColors(source, count, colors, &count); hr = IWICPalette_GetColors(source, count, colors, &count);
if (hr != S_OK) if (hr != S_OK)
{ {
HeapFree(GetProcessHeap(), 0, colors); free(colors);
return hr; return hr;
} }
} }
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This->colors); free(This->colors);
This->colors = colors; This->colors = colors;
This->count = count; This->count = count;
This->type = type; This->type = type;
...@@ -898,7 +898,7 @@ HRESULT PaletteImpl_Create(IWICPalette **palette) ...@@ -898,7 +898,7 @@ HRESULT PaletteImpl_Create(IWICPalette **palette)
{ {
PaletteImpl *This; PaletteImpl *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(PaletteImpl)); This = malloc(sizeof(PaletteImpl));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICPalette_iface.lpVtbl = &PaletteImpl_Vtbl; This->IWICPalette_iface.lpVtbl = &PaletteImpl_Vtbl;
......
...@@ -61,19 +61,19 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -61,19 +61,19 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
if (!name_end_ptr || name_len > 79) if (!name_end_ptr || name_len > 79)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_FAIL; return E_FAIL;
} }
value_len = data_size - name_len - 1; value_len = data_size - name_len - 1;
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); result = calloc(1, sizeof(MetadataItem));
name = CoTaskMemAlloc(name_len + 1); name = CoTaskMemAlloc(name_len + 1);
value = CoTaskMemAlloc(value_len + 1); value = CoTaskMemAlloc(value_len + 1);
if (!result || !name || !value) if (!result || !name || !value)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
HeapFree(GetProcessHeap(), 0, result); free(result);
CoTaskMemFree(name); CoTaskMemFree(name);
CoTaskMemFree(value); CoTaskMemFree(value);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -95,7 +95,7 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -95,7 +95,7 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
*items = result; *items = result;
*item_count = 1; *item_count = 1;
HeapFree(GetProcessHeap(), 0, data); free(data);
return S_OK; return S_OK;
} }
...@@ -127,19 +127,19 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -127,19 +127,19 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor,
if (data_size < 4) if (data_size < 4)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_FAIL; return E_FAIL;
} }
gamma = read_ulong_be(data); gamma = read_ulong_be(data);
HeapFree(GetProcessHeap(), 0, data); free(data);
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); result = calloc(1, sizeof(MetadataItem));
SHStrDupW(L"ImageGamma", &name); SHStrDupW(L"ImageGamma", &name);
if (!result || !name) if (!result || !name)
{ {
HeapFree(GetProcessHeap(), 0, result); free(result);
CoTaskMemFree(name); CoTaskMemFree(name);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -196,11 +196,11 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -196,11 +196,11 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
if (data_size < 32) if (data_size < 32)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_FAIL; return E_FAIL;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)*8); result = calloc(8, sizeof(MetadataItem));
for (i=0; i<8; i++) for (i=0; i<8; i++)
{ {
SHStrDupW(names[i], &dyn_names[i]); SHStrDupW(names[i], &dyn_names[i]);
...@@ -208,10 +208,10 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -208,10 +208,10 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
} }
if (!result || i < 8) if (!result || i < 8)
{ {
HeapFree(GetProcessHeap(), 0, result); free(result);
for (i=0; i<8; i++) for (i=0; i<8; i++)
CoTaskMemFree(dyn_names[i]); CoTaskMemFree(dyn_names[i]);
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -231,7 +231,7 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -231,7 +231,7 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
*items = result; *items = result;
*item_count = 8; *item_count = 8;
HeapFree(GetProcessHeap(), 0, data); free(data);
return S_OK; return S_OK;
} }
...@@ -265,18 +265,18 @@ static HRESULT LoadHistMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -265,18 +265,18 @@ static HRESULT LoadHistMetadata(IStream *stream, const GUID *preferred_vendor,
elements = CoTaskMemAlloc(element_count * sizeof(USHORT)); elements = CoTaskMemAlloc(element_count * sizeof(USHORT));
if (!elements) if (!elements)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
for (i = 0; i < element_count; i++) for (i = 0; i < element_count; i++)
elements[i] = read_ushort_be(data + i * 2); elements[i] = read_ushort_be(data + i * 2);
HeapFree(GetProcessHeap(), 0, data); free(data);
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem)); result = calloc(1, sizeof(MetadataItem));
SHStrDupW(L"Frequencies", &name); SHStrDupW(L"Frequencies", &name);
if (!result || !name) { if (!result || !name) {
HeapFree(GetProcessHeap(), 0, result); free(result);
CoTaskMemFree(name); CoTaskMemFree(name);
CoTaskMemFree(elements); CoTaskMemFree(elements);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -335,11 +335,11 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -335,11 +335,11 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
if (data_size != 7) if (data_size != 7)
{ {
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_FAIL; return E_FAIL;
} }
result = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MetadataItem) * 6); result = calloc(6, sizeof(MetadataItem));
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
SHStrDupW(names[i], &id_values[i]); SHStrDupW(names[i], &id_values[i]);
...@@ -347,10 +347,10 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -347,10 +347,10 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
} }
if (!result || i < 6) if (!result || i < 6)
{ {
HeapFree(GetProcessHeap(), 0, result); free(result);
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
CoTaskMemFree(id_values[i]); CoTaskMemFree(id_values[i]);
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -380,7 +380,7 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor, ...@@ -380,7 +380,7 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
*items = result; *items = result;
*item_count = 6; *item_count = 6;
HeapFree(GetProcessHeap(), 0, data); free(data);
return S_OK; return S_OK;
} }
......
...@@ -96,9 +96,9 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag2 *iface) ...@@ -96,9 +96,9 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag2 *iface)
} }
} }
HeapFree(GetProcessHeap(), 0, This->properties); free(This->properties);
HeapFree(GetProcessHeap(), 0, This->values); free(This->values);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -282,7 +282,7 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, ...@@ -282,7 +282,7 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
HRESULT res = S_OK; HRESULT res = S_OK;
PropertyBag *This; PropertyBag *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(PropertyBag)); This = malloc(sizeof(PropertyBag));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IPropertyBag2_iface.lpVtbl = &PropertyBag_Vtbl; This->IPropertyBag2_iface.lpVtbl = &PropertyBag_Vtbl;
...@@ -296,8 +296,8 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, ...@@ -296,8 +296,8 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
} }
else else
{ {
This->properties = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PROPBAG2)*count); This->properties = calloc(count, sizeof(PROPBAG2));
This->values = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VARIANT)*count); This->values = calloc(count, sizeof(VARIANT));
if (!This->properties || !This->values) if (!This->properties || !This->values)
res = E_OUTOFMEMORY; res = E_OUTOFMEMORY;
......
...@@ -106,7 +106,7 @@ static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface) ...@@ -106,7 +106,7 @@ static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->source) IWICBitmapSource_Release(This->source); if (This->source) IWICBitmapSource_Release(This->source);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -277,13 +277,13 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface, ...@@ -277,13 +277,13 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
src_bytesperrow = (src_rect.Width * This->bpp + 7)/8; src_bytesperrow = (src_rect.Width * This->bpp + 7)/8;
buffer_size = src_bytesperrow * src_rect.Height; buffer_size = src_bytesperrow * src_rect.Height;
src_rows = HeapAlloc(GetProcessHeap(), 0, sizeof(BYTE*) * src_rect.Height); src_rows = malloc(sizeof(BYTE*) * src_rect.Height);
src_bits = HeapAlloc(GetProcessHeap(), 0, buffer_size); src_bits = malloc(buffer_size);
if (!src_rows || !src_bits) if (!src_rows || !src_bits)
{ {
HeapFree(GetProcessHeap(), 0, src_rows); free(src_rows);
HeapFree(GetProcessHeap(), 0, src_bits); free(src_bits);
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto end; goto end;
} }
...@@ -303,8 +303,8 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface, ...@@ -303,8 +303,8 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
} }
} }
HeapFree(GetProcessHeap(), 0, src_rows); free(src_rows);
HeapFree(GetProcessHeap(), 0, src_bits); free(src_bits);
end: end:
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
...@@ -514,7 +514,7 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) ...@@ -514,7 +514,7 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler)
{ {
BitmapScaler *This; BitmapScaler *This;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapScaler)); This = malloc(sizeof(BitmapScaler));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl;
......
...@@ -91,7 +91,7 @@ static ULONG WINAPI StreamOnMemory_Release(IStream *iface) ...@@ -91,7 +91,7 @@ static ULONG WINAPI StreamOnMemory_Release(IStream *iface)
if (ref == 0) { if (ref == 0) {
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -326,7 +326,7 @@ static ULONG WINAPI StreamOnFileHandle_Release(IStream *iface) ...@@ -326,7 +326,7 @@ static ULONG WINAPI StreamOnFileHandle_Release(IStream *iface)
IWICStream_Release(This->stream); IWICStream_Release(This->stream);
UnmapViewOfFile(This->mem); UnmapViewOfFile(This->mem);
CloseHandle(This->map); CloseHandle(This->map);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -501,7 +501,7 @@ static ULONG WINAPI StreamOnStreamRange_Release(IStream *iface) ...@@ -501,7 +501,7 @@ static ULONG WINAPI StreamOnStreamRange_Release(IStream *iface)
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
IStream_Release(This->stream); IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -795,7 +795,7 @@ static ULONG WINAPI IWICStreamImpl_Release(IWICStream *iface) ...@@ -795,7 +795,7 @@ static ULONG WINAPI IWICStreamImpl_Release(IWICStream *iface)
if (ref == 0) { if (ref == 0) {
if (This->pStream) IStream_Release(This->pStream); if (This->pStream) IStream_Release(This->pStream);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -994,7 +994,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromMemory(IWICStream *iface, ...@@ -994,7 +994,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromMemory(IWICStream *iface,
if (!pbBuffer) return E_INVALIDARG; if (!pbBuffer) return E_INVALIDARG;
if (This->pStream) return WINCODEC_ERR_WRONGSTATE; if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(StreamOnMemory)); pObject = malloc(sizeof(StreamOnMemory));
if (!pObject) return E_OUTOFMEMORY; if (!pObject) return E_OUTOFMEMORY;
pObject->IStream_iface.lpVtbl = &StreamOnMemory_Vtbl; pObject->IStream_iface.lpVtbl = &StreamOnMemory_Vtbl;
...@@ -1058,7 +1058,7 @@ HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file) ...@@ -1058,7 +1058,7 @@ HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file)
hr = IWICStreamImpl_InitializeFromMemory(stream, mem, size.u.LowPart); hr = IWICStreamImpl_InitializeFromMemory(stream, mem, size.u.LowPart);
if (FAILED(hr)) goto error; if (FAILED(hr)) goto error;
pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(StreamOnFileHandle)); pObject = malloc(sizeof(StreamOnFileHandle));
if (!pObject) if (!pObject)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -1097,7 +1097,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *ifa ...@@ -1097,7 +1097,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *ifa
if (!pIStream) return E_INVALIDARG; if (!pIStream) return E_INVALIDARG;
if (This->pStream) return WINCODEC_ERR_WRONGSTATE; if (This->pStream) return WINCODEC_ERR_WRONGSTATE;
pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(StreamOnStreamRange)); pObject = malloc(sizeof(StreamOnStreamRange));
if (!pObject) return E_OUTOFMEMORY; if (!pObject) return E_OUTOFMEMORY;
pObject->IStream_iface.lpVtbl = &StreamOnStreamRange_Vtbl; pObject->IStream_iface.lpVtbl = &StreamOnStreamRange_Vtbl;
...@@ -1153,7 +1153,7 @@ HRESULT StreamImpl_Create(IWICStream **stream) ...@@ -1153,7 +1153,7 @@ HRESULT StreamImpl_Create(IWICStream **stream)
if( !stream ) return E_INVALIDARG; if( !stream ) return E_INVALIDARG;
pObject = HeapAlloc(GetProcessHeap(), 0, sizeof(IWICStreamImpl)); pObject = malloc(sizeof(IWICStreamImpl));
if( !pObject ) { if( !pObject ) {
*stream = NULL; *stream = NULL;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -170,8 +170,8 @@ static ULONG WINAPI TgaDecoder_Release(IWICBitmapDecoder *iface) ...@@ -170,8 +170,8 @@ static ULONG WINAPI TgaDecoder_Release(IWICBitmapDecoder *iface)
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if (This->stream) if (This->stream)
IStream_Release(This->stream); IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This->imagebits); free(This->imagebits);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -623,7 +623,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, ...@@ -623,7 +623,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
return E_FAIL; return E_FAIL;
} }
colormap_data = HeapAlloc(GetProcessHeap(), 0, This->colormap_length); colormap_data = malloc(This->colormap_length);
if (!colormap_data) return E_OUTOFMEMORY; if (!colormap_data) return E_OUTOFMEMORY;
wcolormap_data = (WORD*)colormap_data; wcolormap_data = (WORD*)colormap_data;
...@@ -743,7 +743,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, ...@@ -743,7 +743,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
} }
} }
HeapFree(GetProcessHeap(), 0, colormap_data); free(colormap_data);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IWICPalette_InitializeCustom(pIPalette, colors, 256); hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
...@@ -831,7 +831,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This) ...@@ -831,7 +831,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
datasize = This->header.width * This->header.height * (This->header.depth / 8); datasize = This->header.width * This->header.height * (This->header.depth / 8);
This->imagebits = HeapAlloc(GetProcessHeap(), 0, datasize); This->imagebits = malloc(datasize);
if (!This->imagebits) hr = E_OUTOFMEMORY; if (!This->imagebits) hr = E_OUTOFMEMORY;
} }
...@@ -870,7 +870,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This) ...@@ -870,7 +870,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, This->imagebits); free(This->imagebits);
This->imagebits = NULL; This->imagebits = NULL;
} }
} }
...@@ -944,7 +944,7 @@ HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) ...@@ -944,7 +944,7 @@ HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv)
*ppv = NULL; *ppv = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(TgaDecoder)); This = malloc(sizeof(TgaDecoder));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &TgaDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &TgaDecoder_Vtbl;
......
...@@ -58,26 +58,6 @@ ...@@ -58,26 +58,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
static void *ungif_alloc( size_t sz )
{
return HeapAlloc( GetProcessHeap(), 0, sz );
}
static void *ungif_calloc( size_t num, size_t sz )
{
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, num*sz );
}
static void *ungif_realloc( void *ptr, size_t sz )
{
return HeapReAlloc( GetProcessHeap(), 0, ptr, sz );
}
static void ungif_free( void *ptr )
{
HeapFree( GetProcessHeap(), 0, ptr );
}
#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ #define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
#define LZ_BITS 12 #define LZ_BITS 12
...@@ -154,14 +134,14 @@ MakeMapObject(int ColorCount, ...@@ -154,14 +134,14 @@ MakeMapObject(int ColorCount,
return NULL; return NULL;
} }
Object = ungif_alloc(sizeof(ColorMapObject)); Object = malloc(sizeof(ColorMapObject));
if (Object == NULL) { if (Object == NULL) {
return NULL; return NULL;
} }
Object->Colors = ungif_calloc(ColorCount, sizeof(GifColorType)); Object->Colors = calloc(ColorCount, sizeof(GifColorType));
if (Object->Colors == NULL) { if (Object->Colors == NULL) {
ungif_free(Object); free(Object);
return NULL; return NULL;
} }
...@@ -182,8 +162,8 @@ static void ...@@ -182,8 +162,8 @@ static void
FreeMapObject(ColorMapObject * Object) { FreeMapObject(ColorMapObject * Object) {
if (Object != NULL) { if (Object != NULL) {
ungif_free(Object->Colors); free(Object->Colors);
ungif_free(Object); free(Object);
/*** FIXME: /*** FIXME:
* When we are willing to break API we need to make this function * When we are willing to break API we need to make this function
* FreeMapObject(ColorMapObject **Object) * FreeMapObject(ColorMapObject **Object)
...@@ -200,12 +180,9 @@ AddExtensionBlock(Extensions *New, ...@@ -200,12 +180,9 @@ AddExtensionBlock(Extensions *New,
ExtensionBlock *ep; ExtensionBlock *ep;
if (New->ExtensionBlocks == NULL) New->ExtensionBlocks = realloc(New->ExtensionBlocks,
New->ExtensionBlocks = ungif_alloc(sizeof(ExtensionBlock)); sizeof(ExtensionBlock) *
else (New->ExtensionBlockCount + 1));
New->ExtensionBlocks = ungif_realloc(New->ExtensionBlocks,
sizeof(ExtensionBlock) *
(New->ExtensionBlockCount + 1));
if (New->ExtensionBlocks == NULL) if (New->ExtensionBlocks == NULL)
return (GIF_ERROR); return (GIF_ERROR);
...@@ -213,7 +190,7 @@ AddExtensionBlock(Extensions *New, ...@@ -213,7 +190,7 @@ AddExtensionBlock(Extensions *New,
ep = &New->ExtensionBlocks[New->ExtensionBlockCount++]; ep = &New->ExtensionBlocks[New->ExtensionBlockCount++];
ep->ByteCount=Len + 3; ep->ByteCount=Len + 3;
ep->Bytes = ungif_alloc(ep->ByteCount + 3); ep->Bytes = malloc(ep->ByteCount + 3);
if (ep->Bytes == NULL) if (ep->Bytes == NULL)
return (GIF_ERROR); return (GIF_ERROR);
...@@ -242,7 +219,7 @@ AppendExtensionBlock(Extensions *New, ...@@ -242,7 +219,7 @@ AppendExtensionBlock(Extensions *New,
ep = &New->ExtensionBlocks[New->ExtensionBlockCount - 1]; ep = &New->ExtensionBlocks[New->ExtensionBlockCount - 1];
ep->Bytes = ungif_realloc(ep->Bytes, ep->ByteCount + Len + 1); ep->Bytes = realloc(ep->Bytes, ep->ByteCount + Len + 1);
if (ep->Bytes == NULL) if (ep->Bytes == NULL)
return (GIF_ERROR); return (GIF_ERROR);
...@@ -266,8 +243,8 @@ FreeExtension(Extensions *Extensions) ...@@ -266,8 +243,8 @@ FreeExtension(Extensions *Extensions)
} }
for (ep = Extensions->ExtensionBlocks; for (ep = Extensions->ExtensionBlocks;
ep < (Extensions->ExtensionBlocks + Extensions->ExtensionBlockCount); ep++) ep < (Extensions->ExtensionBlocks + Extensions->ExtensionBlockCount); ep++)
ungif_free(ep->Bytes); free(ep->Bytes);
ungif_free(Extensions->ExtensionBlocks); free(Extensions->ExtensionBlocks);
Extensions->ExtensionBlocks = NULL; Extensions->ExtensionBlocks = NULL;
} }
...@@ -290,12 +267,12 @@ FreeSavedImages(GifFileType * GifFile) { ...@@ -290,12 +267,12 @@ FreeSavedImages(GifFileType * GifFile) {
sp->ImageDesc.ColorMap = NULL; sp->ImageDesc.ColorMap = NULL;
} }
ungif_free(sp->RasterBits); free(sp->RasterBits);
if (sp->Extensions.ExtensionBlocks) if (sp->Extensions.ExtensionBlocks)
FreeExtension(&sp->Extensions); FreeExtension(&sp->Extensions);
} }
ungif_free(GifFile->SavedImages); free(GifFile->SavedImages);
GifFile->SavedImages=NULL; GifFile->SavedImages=NULL;
} }
...@@ -432,16 +409,10 @@ DGifGetImageDesc(GifFileType * GifFile) { ...@@ -432,16 +409,10 @@ DGifGetImageDesc(GifFileType * GifFile) {
GifFile->Image.ColorMap = NULL; GifFile->Image.ColorMap = NULL;
} }
if (GifFile->SavedImages) { if ((GifFile->SavedImages = realloc(GifFile->SavedImages,
if ((GifFile->SavedImages = ungif_realloc(GifFile->SavedImages, sizeof(SavedImage) *
sizeof(SavedImage) * (GifFile->ImageCount + 1))) == NULL) {
(GifFile->ImageCount + 1))) == NULL) { return GIF_ERROR;
return GIF_ERROR;
}
} else {
if ((GifFile->SavedImages = ungif_alloc(sizeof(SavedImage))) == NULL) {
return GIF_ERROR;
}
} }
sp = &GifFile->SavedImages[GifFile->ImageCount]; sp = &GifFile->SavedImages[GifFile->ImageCount];
...@@ -896,7 +867,7 @@ DGifSlurp(GifFileType * GifFile) { ...@@ -896,7 +867,7 @@ DGifSlurp(GifFileType * GifFile) {
sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; sp = &GifFile->SavedImages[GifFile->ImageCount - 1];
ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height;
sp->RasterBits = ungif_alloc(ImageSize * sizeof(GifPixelType)); sp->RasterBits = malloc(ImageSize * sizeof(GifPixelType));
if (sp->RasterBits == NULL) { if (sp->RasterBits == NULL) {
return GIF_ERROR; return GIF_ERROR;
} }
...@@ -997,16 +968,16 @@ DGifOpen(void *userData, ...@@ -997,16 +968,16 @@ DGifOpen(void *userData,
GifFileType *GifFile; GifFileType *GifFile;
GifFilePrivateType *Private; GifFilePrivateType *Private;
GifFile = ungif_alloc(sizeof(GifFileType)); GifFile = malloc(sizeof(GifFileType));
if (GifFile == NULL) { if (GifFile == NULL) {
return NULL; return NULL;
} }
memset(GifFile, '\0', sizeof(GifFileType)); memset(GifFile, '\0', sizeof(GifFileType));
Private = ungif_alloc(sizeof(GifFilePrivateType)); Private = malloc(sizeof(GifFilePrivateType));
if (!Private) { if (!Private) {
ungif_free(GifFile); free(GifFile);
return NULL; return NULL;
} }
...@@ -1017,8 +988,8 @@ DGifOpen(void *userData, ...@@ -1017,8 +988,8 @@ DGifOpen(void *userData,
/* Lets see if this is a GIF file: */ /* Lets see if this is a GIF file: */
if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) {
ungif_free(Private); free(Private);
ungif_free(GifFile); free(GifFile);
return NULL; return NULL;
} }
...@@ -1026,14 +997,14 @@ DGifOpen(void *userData, ...@@ -1026,14 +997,14 @@ DGifOpen(void *userData,
* something more useful with it. */ * something more useful with it. */
Buf[GIF_STAMP_LEN] = 0; Buf[GIF_STAMP_LEN] = 0;
if (memcmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { if (memcmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) {
ungif_free(Private); free(Private);
ungif_free(GifFile); free(GifFile);
return NULL; return NULL;
} }
if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { if (DGifGetScreenDesc(GifFile) == GIF_ERROR) {
ungif_free(Private); free(Private);
ungif_free(GifFile); free(GifFile);
return NULL; return NULL;
} }
...@@ -1063,7 +1034,7 @@ DGifCloseFile(GifFileType * GifFile) { ...@@ -1063,7 +1034,7 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile->SColorMap = NULL; GifFile->SColorMap = NULL;
} }
ungif_free(Private); free(Private);
Private = NULL; Private = NULL;
if (GifFile->SavedImages) { if (GifFile->SavedImages) {
...@@ -1073,7 +1044,7 @@ DGifCloseFile(GifFileType * GifFile) { ...@@ -1073,7 +1044,7 @@ DGifCloseFile(GifFileType * GifFile) {
FreeExtension(&GifFile->Extensions); FreeExtension(&GifFile->Extensions);
ungif_free(GifFile); free(GifFile);
return GIF_OK; return GIF_OK;
} }
...@@ -151,7 +151,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface, ...@@ -151,7 +151,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
stride = (bpp * width + 7)/8; stride = (bpp * width + 7)/8;
pixeldata = HeapAlloc(GetProcessHeap(), 0, stride * prc->Height); pixeldata = malloc(stride * prc->Height);
if (!pixeldata) if (!pixeldata)
{ {
IWICBitmapSource_Release(converted_source); IWICBitmapSource_Release(converted_source);
...@@ -167,7 +167,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface, ...@@ -167,7 +167,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
stride*prc->Height, pixeldata); stride*prc->Height, pixeldata);
} }
HeapFree(GetProcessHeap(), 0, pixeldata); free(pixeldata);
IWICBitmapSource_Release(converted_source); IWICBitmapSource_Release(converted_source);
return hr; return hr;
......
...@@ -173,7 +173,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz ...@@ -173,7 +173,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz
if (data) if (data)
{ {
*data = RtlAllocateHeap(GetProcessHeap(), 0, *data_size); *data = malloc(*data_size);
if (!*data) if (!*data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -183,7 +183,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz ...@@ -183,7 +183,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz
{ {
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = E_FAIL; hr = E_FAIL;
RtlFreeHeap(GetProcessHeap(), 0, *data); free(*data);
*data = NULL; *data = NULL;
return hr; return hr;
} }
......
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