From 61de79dcab2896ab0dc5b5325fdb20432d750d40 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 9 Feb 2018 09:41:26 +0300 Subject: [PATCH] comctl32/animate: Use the global HeapAlloc() helpers. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/animate.c | 74 ++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index 12c4f65c4aa..169291b3001 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -45,6 +45,7 @@ #include "mmsystem.h" #include "comctl32.h" #include "wine/debug.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(animate); @@ -188,36 +189,39 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr) static void ANIMATE_Free(ANIMATE_INFO *infoPtr) { - if (infoPtr->hMMio) { - ANIMATE_DoStop(infoPtr); - mmioClose(infoPtr->hMMio, 0); - if (infoPtr->hRes) { - FreeResource(infoPtr->hRes); - infoPtr->hRes = 0; - } - Free (infoPtr->lpIndex); - infoPtr->lpIndex = NULL; - if (infoPtr->hic) { - fnIC.fnICClose(infoPtr->hic); - infoPtr->hic = 0; - } - Free (infoPtr->inbih); - infoPtr->inbih = NULL; - Free (infoPtr->outbih); - infoPtr->outbih = NULL; - Free (infoPtr->indata); - infoPtr->indata = NULL; - Free (infoPtr->outdata); - infoPtr->outdata = NULL; - if( infoPtr->hbmPrevFrame ) + if (infoPtr->hMMio) + { + ANIMATE_DoStop(infoPtr); + mmioClose(infoPtr->hMMio, 0); + if (infoPtr->hRes) { - DeleteObject(infoPtr->hbmPrevFrame); + FreeResource(infoPtr->hRes); + infoPtr->hRes = 0; + } + heap_free (infoPtr->lpIndex); + infoPtr->lpIndex = NULL; + if (infoPtr->hic) + { + fnIC.fnICClose(infoPtr->hic); + infoPtr->hic = 0; + } + heap_free (infoPtr->inbih); + infoPtr->inbih = NULL; + heap_free (infoPtr->outbih); + infoPtr->outbih = NULL; + heap_free (infoPtr->indata); + infoPtr->indata = NULL; + heap_free (infoPtr->outdata); + infoPtr->outdata = NULL; + if (infoPtr->hbmPrevFrame) + { + DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = 0; } - memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); - memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); - infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0; + memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); + memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); + infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0; } infoPtr->transparentColor = ANIMATE_COLOR_NONE; } @@ -571,7 +575,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) return FALSE; } - infoPtr->inbih = Alloc(mmckInfo.cksize); + infoPtr->inbih = heap_alloc_zero(mmckInfo.cksize); if (!infoPtr->inbih) { WARN("Can't alloc input BIH\n"); return FALSE; @@ -618,7 +622,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) /* FIXME: should handle the 'rec ' LIST when present */ - infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD)); + infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD)); if (!infoPtr->lpIndex) return FALSE; @@ -640,7 +644,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) infoPtr->ash.dwSuggestedBufferSize = insize; } - infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize); + infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize); if (!infoPtr->indata) return FALSE; @@ -671,7 +675,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD_PTR)infoPtr->inbih, 0L); - infoPtr->outbih = Alloc(outSize); + infoPtr->outbih = heap_alloc_zero(outSize); if (!infoPtr->outbih) return FALSE; @@ -682,7 +686,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) return FALSE; } - infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage); + infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage); if (!infoPtr->outdata) return FALSE; @@ -776,12 +780,12 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName); len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0); - lpwszName = Alloc(len * sizeof(WCHAR)); + lpwszName = heap_alloc(len * sizeof(WCHAR)); if (!lpwszName) return FALSE; MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len); result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName); - Free (lpwszName); + heap_free (lpwszName); return result; } @@ -814,7 +818,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs) } /* allocate memory for info structure */ - infoPtr = Alloc(sizeof(ANIMATE_INFO)); + infoPtr = heap_alloc_zero(sizeof(*infoPtr)); if (!infoPtr) return FALSE; /* store crossref hWnd <-> info structure */ @@ -844,7 +848,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr) infoPtr->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&infoPtr->cs); - Free(infoPtr); + heap_free(infoPtr); return 0; }