Commit 6b7689cb authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

avifil32: Use CRT allocation functions.

parent 4059c6ec
......@@ -86,7 +86,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
hr = AVIStreamFormatSize(This->pStream, This->sInfo.dwStart, &This->cbInFormat);
if (FAILED(hr))
return hr;
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat);
This->lpInFormat = malloc(This->cbInFormat);
if (This->lpInFormat == NULL)
return AVIERR_MEMORY;
......@@ -98,7 +98,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
if (This->lpOutFormat == NULL) {
/* we must decode to default format */
This->cbOutFormat = sizeof(WAVEFORMATEX);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
This->lpOutFormat = malloc(This->cbOutFormat);
if (This->lpOutFormat == NULL)
return AVIERR_MEMORY;
......@@ -181,17 +181,17 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
acmStreamClose(This->has, 0);
This->has = NULL;
}
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc);
free(This->acmStreamHdr.pbSrc);
This->acmStreamHdr.pbSrc = NULL;
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
free(This->acmStreamHdr.pbDst);
This->acmStreamHdr.pbDst = NULL;
if (This->lpInFormat != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
free(This->lpInFormat);
This->lpInFormat = NULL;
This->cbInFormat = 0;
}
if (This->lpOutFormat != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
free(This->lpOutFormat);
This->lpOutFormat = NULL;
This->cbOutFormat = 0;
}
......@@ -199,7 +199,7 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
IAVIStream_Release(This->pStream);
This->pStream = NULL;
}
HeapFree(GetProcessHeap(), 0, This);
free(This);
return 0;
}
......@@ -251,7 +251,7 @@ static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
else
This->cbOutFormat = sizeof(WAVEFORMATEX);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
This->lpOutFormat = malloc(This->cbOutFormat);
if (This->lpOutFormat == NULL)
return AVIERR_MEMORY;
......@@ -384,7 +384,7 @@ static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0)
return AVIERR_READONLY;
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, formatsize);
This->lpInFormat = malloc(formatsize);
if (This->lpInFormat == NULL)
return AVIERR_MEMORY;
This->cbInFormat = formatsize;
......@@ -464,7 +464,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* Need to free destination buffer used for writing? */
if (This->acmStreamHdr.pbDst != NULL) {
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst);
free(This->acmStreamHdr.pbDst);
This->acmStreamHdr.pbDst = NULL;
This->acmStreamHdr.dwDstUser = 0;
}
......@@ -472,10 +472,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* need bigger source buffer? */
if (This->acmStreamHdr.pbSrc == NULL ||
This->acmStreamHdr.dwSrcUser < size) {
if (This->acmStreamHdr.pbSrc == NULL)
This->acmStreamHdr.pbSrc = HeapAlloc(GetProcessHeap(), 0, size);
else
This->acmStreamHdr.pbSrc = HeapReAlloc(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc, size);
This->acmStreamHdr.pbSrc = realloc(This->acmStreamHdr.pbSrc, size);
if (This->acmStreamHdr.pbSrc == NULL)
return AVIERR_MEMORY;
This->acmStreamHdr.dwSrcUser = size;
......@@ -567,7 +564,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need to free source buffer used for reading? */
if (This->acmStreamHdr.pbSrc != NULL) {
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc);
free(This->acmStreamHdr.pbSrc);
This->acmStreamHdr.pbSrc = NULL;
This->acmStreamHdr.dwSrcUser = 0;
}
......@@ -575,10 +572,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need bigger destination buffer? */
if (This->acmStreamHdr.pbDst == NULL ||
This->acmStreamHdr.dwDstUser < size) {
if (This->acmStreamHdr.pbDst == NULL)
This->acmStreamHdr.pbDst = HeapAlloc(GetProcessHeap(), 0, size);
else
This->acmStreamHdr.pbDst = HeapReAlloc(GetProcessHeap(), 0, This->acmStreamHdr.pbDst, size);
This->acmStreamHdr.pbDst = realloc(This->acmStreamHdr.pbDst, size);
if (This->acmStreamHdr.pbDst == NULL)
return AVIERR_MEMORY;
This->acmStreamHdr.dwDstUser = size;
......@@ -710,7 +704,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl));
pstream = calloc(1, sizeof(IAVIStreamImpl));
if (pstream == NULL)
return AVIERR_MEMORY;
......@@ -718,7 +712,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream);
free(pstream);
return hr;
}
......@@ -209,19 +209,19 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2)
return FALSE;
/* sizes match, now get formats and compare them */
fmt1 = HeapAlloc(GetProcessHeap(), 0, size1);
fmt1 = malloc(size1);
if (fmt1 == NULL)
return FALSE;
if (SUCCEEDED(AVIStreamReadFormat(avi1, start1, fmt1, &size1))) {
fmt2 = HeapAlloc(GetProcessHeap(), 0, size1);
fmt2 = malloc(size1);
if (fmt2 != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(avi2, start2, fmt2, &size1)))
status = (memcmp(fmt1, fmt2, size1) == 0);
}
}
HeapFree(GetProcessHeap(), 0, fmt2);
HeapFree(GetProcessHeap(), 0, fmt1);
free(fmt2);
free(fmt1);
return status;
}
......@@ -278,10 +278,10 @@ static ULONG WINAPI IAVIEditStream_fnRelease(IAVIEditStream*iface)
if (This->pStreams[i].pStream != NULL)
IAVIStream_Release(This->pStreams[i].pStream);
}
HeapFree(GetProcessHeap(), 0, This->pStreams);
free(This->pStreams);
}
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return ref;
}
......@@ -343,8 +343,7 @@ static HRESULT WINAPI IAVIEditStream_fnCut(IAVIEditStream*iface,LONG*plStart,
} else {
/* splitting */
if (This->nStreams + 1 >= This->nTableSize) {
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams,
(This->nTableSize + 32) * sizeof(EditStreamTable));
This->pStreams = _recalloc(This->pStreams, This->nTableSize + 32, sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize += 32;
......@@ -530,7 +529,7 @@ static HRESULT WINAPI IAVIEditStream_fnPaste(IAVIEditStream*iface,LONG*plStart,
if (This->nStreams + nStreams + 1 > This->nTableSize) {
n = This->nStreams + nStreams + 33;
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams, n * sizeof(EditStreamTable));
This->pStreams = _recalloc(This->pStreams, n, sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = n;
......@@ -619,8 +618,7 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
if (pEdit == NULL)
return AVIERR_MEMORY;
if (This->nStreams > pEdit->nTableSize) {
pEdit->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pEdit->pStreams,
This->nStreams * sizeof(EditStreamTable));
pEdit->pStreams = _recalloc(pEdit->pStreams, This->nStreams, sizeof(EditStreamTable));
if (pEdit->pStreams == NULL)
return AVIERR_MEMORY;
pEdit->nTableSize = This->nStreams;
......@@ -702,7 +700,7 @@ static HRESULT WINAPI IEditAVIStream_fnCreate(IAVIStream*iface,
return AVIERR_ERROR;
if (This->pStreams == NULL) {
This->pStreams = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 256 * sizeof(EditStreamTable));
This->pStreams = calloc(256, sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = 256;
......@@ -1010,7 +1008,7 @@ static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream)
{
IAVIEditStreamImpl *pedit = NULL;
pedit = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIEditStreamImpl));
pedit = calloc(1, sizeof(IAVIEditStreamImpl));
if (pedit == NULL)
return NULL;
......
......@@ -76,11 +76,7 @@ HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPCVOID lpData, LONG siz
assert(lpData != NULL);
assert(size > 0);
if (extra->lp)
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + size + 2 * sizeof(DWORD));
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 2 * sizeof(DWORD));
lp = _recalloc(extra->lp, 1, extra->cb + size + 2 * sizeof(DWORD));
if (lp == NULL)
return AVIERR_MEMORY;
......@@ -112,11 +108,7 @@ HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO *lpck)
cb = lpck->cksize + 2 * sizeof(DWORD);
cb += (cb & 1);
if (extra->lp != NULL)
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + cb);
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
lp = _recalloc(extra->lp, 1, extra->cb + cb);
if (lp == NULL)
return AVIERR_MEMORY;
......
......@@ -82,7 +82,7 @@ static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface)
TRACE("(%p) ref = %lu\n", This, ref);
if(!ref)
HeapFree(GetProcessHeap(), 0, This);
free(This);
return ref;
}
......@@ -140,7 +140,7 @@ static HRESULT AVIFILE_CreateClassFactory(const CLSID *clsid, const IID *riid, v
*ppv = NULL;
cf = HeapAlloc(GetProcessHeap(), 0, sizeof(*cf));
cf = malloc(sizeof(*cf));
if (!cf)
return E_OUTOFMEMORY;
......
......@@ -77,10 +77,10 @@ static inline IGetFrameImpl *impl_from_IGetFrame(IGetFrame *iface)
static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
{
if (This->lpInFormat != This->lpOutFormat) {
HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
free(This->lpOutFormat);
This->lpOutFormat = NULL;
}
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
free(This->lpInFormat);
This->lpInFormat = NULL;
if (This->hic != NULL) {
if (This->bResize)
......@@ -133,7 +133,7 @@ static ULONG WINAPI IGetFrame_fnRelease(IGetFrame *iface)
This->pStream = NULL;
}
HeapFree(GetProcessHeap(), 0, iface);
free(iface);
}
return ref;
......@@ -222,7 +222,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos)
if (This->cbInBuffer >= readBytes)
break;
This->cbInBuffer = This->cbInFormat + readBytes;
This->lpInFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpInFormat, This->cbInBuffer);
This->lpInFormat = realloc(This->lpInFormat, This->cbInBuffer);
if (This->lpInFormat == NULL)
return NULL; /* out of memory */
This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat;
......@@ -322,7 +322,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
NULL, &This->cbInFormat);
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat + This->cbInBuffer);
This->lpInFormat = malloc(This->cbInFormat + This->cbInBuffer);
if (This->lpInFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
......@@ -361,8 +361,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
/* need memory for output format? */
if (This->lpOutFormat == NULL) {
This->lpOutFormat =
HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
This->lpOutFormat = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
......@@ -430,7 +429,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size);
This->lpOutFormat = realloc(This->lpOutFormat, size);
if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
......@@ -492,7 +491,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream)
if (pStream == NULL)
return NULL;
pg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGetFrameImpl));
pg = calloc(1, sizeof(IGetFrameImpl));
if (pg != NULL) {
pg->IGetFrame_iface.lpVtbl = &igetframeVtbl;
pg->ref = 1;
......
......@@ -140,7 +140,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
if (This->hic != NULL) {
if (This->lpbiPrev != NULL) {
ICDecompressEnd(This->hic);
HeapFree(GetProcessHeap(), 0, This->lpbiPrev);
free(This->lpbiPrev);
This->lpbiPrev = NULL;
This->lpPrev = NULL;
}
......@@ -148,22 +148,22 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
This->hic = NULL;
}
if (This->lpbiCur != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiCur);
free(This->lpbiCur);
This->lpbiCur = NULL;
This->lpCur = NULL;
}
if (This->lpbiOutput != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiOutput);
free(This->lpbiOutput);
This->lpbiOutput = NULL;
This->cbOutput = 0;
}
if (This->lpbiInput != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiInput);
free(This->lpbiInput);
This->lpbiInput = NULL;
This->cbInput = 0;
}
HeapFree(GetProcessHeap(), 0, This);
free(This);
return 0;
}
......@@ -425,7 +425,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
assert(This->hic != NULL);
/* get memory for input format */
This->lpbiInput = HeapAlloc(GetProcessHeap(), 0, formatsize);
This->lpbiInput = malloc(formatsize);
if (This->lpbiInput == NULL)
return AVIERR_MEMORY;
This->cbInput = formatsize;
......@@ -435,7 +435,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
if (size < sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiOutput = malloc(size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
......@@ -454,7 +454,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* allocate memory for compressed frame */
size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput);
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, This->cbOutput + size);
This->lpbiCur = malloc(This->cbOutput + size);
if (This->lpbiCur == NULL)
return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
......@@ -464,7 +464,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiPrev = malloc(size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
......@@ -477,7 +477,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* get memory for format and picture */
size += This->lpbiPrev->biSizeImage;
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size);
This->lpbiPrev = realloc(This->lpbiPrev, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev);
......@@ -733,7 +733,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl));
pstream = calloc(1, sizeof(IAVIStreamImpl));
if (pstream == NULL)
return AVIERR_MEMORY;
......@@ -742,7 +742,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream);
free(pstream);
return hr;
}
......@@ -900,7 +900,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
size = ICCompressGetFormatSize(This->hic, lpbi);
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiOutput = malloc(size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
......@@ -922,7 +922,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* allocate memory for current frame */
size += This->sInfo.dwSuggestedBufferSize;
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiCur = malloc(size);
if (This->lpbiCur == NULL)
return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
......@@ -932,7 +932,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiPrev = malloc(size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
......@@ -945,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* get memory for format and picture */
size += This->lpbiPrev->biSizeImage;
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size );
This->lpbiPrev = realloc(This->lpbiPrev, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev);
......
......@@ -93,7 +93,7 @@ static ULONG WINAPI ITmpFile_fnRelease(IAVIFile *iface)
}
}
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return ref;
......@@ -222,7 +222,7 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
ITmpFileImpl *tmpFile;
int i;
tmpFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ITmpFileImpl));
tmpFile = calloc(1, sizeof(ITmpFileImpl));
if (tmpFile == NULL)
return NULL;
......@@ -231,9 +231,9 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
memset(&tmpFile->fInfo, 0, sizeof(tmpFile->fInfo));
tmpFile->fInfo.dwStreams = nStreams;
tmpFile->ppStreams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(PAVISTREAM));
tmpFile->ppStreams = malloc(nStreams * sizeof(PAVISTREAM));
if (tmpFile->ppStreams == NULL) {
HeapFree(GetProcessHeap(), 0, tmpFile);
free(tmpFile);
return NULL;
}
......
......@@ -169,19 +169,19 @@ static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface)
if (This->fDirty)
AVIFILE_SaveFile(This);
HeapFree(GetProcessHeap(), 0, This->lpFormat);
free(This->lpFormat);
This->lpFormat = NULL;
This->cbFormat = 0;
HeapFree(GetProcessHeap(), 0, This->extra.lp);
free(This->extra.lp);
This->extra.lp = NULL;
This->extra.cb = 0;
HeapFree(GetProcessHeap(), 0, This->szFileName);
free(This->szFileName);
This->szFileName = NULL;
if (This->hmmio) {
mmioClose(This->hmmio, 0);
This->hmmio = NULL;
}
HeapFree(GetProcessHeap(), 0, This);
free(This);
}
return ref;
......@@ -388,7 +388,7 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO
if ((This->uMode & MMIO_RWMODE) == 0)
return AVIERR_READONLY;
HeapFree(GetProcessHeap(), 0, This->lpFormat);
free(This->lpFormat);
This->lpFormat = NULL;
This->cbFormat = 0;
......@@ -492,7 +492,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
This->uMode = dwMode;
len = lstrlenW(pszFileName) + 1;
This->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
This->szFileName = malloc(len * sizeof(WCHAR));
if (This->szFileName == NULL)
return AVIERR_MEMORY;
lstrcpyW(This->szFileName, pszFileName);
......@@ -504,7 +504,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
LPSTR szFileName;
len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1,
NULL, 0, NULL, NULL);
szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR));
szFileName = malloc(len * sizeof(CHAR));
if (szFileName == NULL)
return AVIERR_MEMORY;
......@@ -512,7 +512,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
len, NULL, NULL);
This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
HeapFree(GetProcessHeap(), 0, szFileName);
free(szFileName);
if (This->hmmio == NULL)
return AVIERR_FILEOPEN;
}
......@@ -741,7 +741,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *
return AVIERR_READONLY;
/* get memory for format and copy it */
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, formatsize);
This->lpFormat = malloc(formatsize);
if (This->lpFormat == NULL)
return AVIERR_MEMORY;
......@@ -982,7 +982,7 @@ HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface
*ret_iface = NULL;
pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pfile));
pfile = calloc(1, sizeof(*pfile));
if (!pfile)
return AVIERR_MEMORY;
......@@ -1028,7 +1028,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
return AVIERR_FILEREAD;
/* get memory for format and read it */
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, ck.cksize);
This->lpFormat = malloc(ck.cksize);
if (This->lpFormat == NULL)
return AVIERR_FILEREAD;
This->cbFormat = ck.cksize;
......@@ -1117,7 +1117,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
This->cbFormat = sizeof(WAVEFORMATEX); break;
};
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, This->cbFormat);
This->lpFormat = malloc(This->cbFormat);
if (This->lpFormat == NULL)
return AVIERR_MEMORY;
......
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