- Fix mismatched allocation/free. Spotted by Samuel & cppcheck
CORE-8207 #resolve

svn path=/trunk/; revision=63249
This commit is contained in:
Thomas Faber 2014-05-12 06:19:07 +00:00
parent 76f9d532f2
commit dbe30dfb59
2 changed files with 3 additions and 3 deletions

View file

@ -200,7 +200,7 @@ copy(TCHAR source[MAX_PATH],
}
/* A page-aligned buffer usually give more speed */
buffer = (LPBYTE)VirtualAlloc(NULL, BUFF_SIZE, MEM_COMMIT, PAGE_READWRITE);
buffer = VirtualAlloc(NULL, BUFF_SIZE, MEM_COMMIT, PAGE_READWRITE);
if (buffer == NULL)
{
CloseHandle (hFileDest);

View file

@ -160,7 +160,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
}
/* Get buffer for the copy process */
buffer = (LPBYTE)VirtualAlloc(NULL, BUFF_SIZE, MEM_COMMIT, PAGE_READWRITE);
buffer = VirtualAlloc(NULL, BUFF_SIZE, MEM_COMMIT, PAGE_READWRITE);
if (buffer == NULL)
{
CloseHandle (hFileDest);
@ -188,7 +188,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
if (dwWritten != dwRead || CheckCtrlBreak(BREAK_INPUT))
{
ConOutResPuts(STRING_COPY_ERROR3);
cmd_free (buffer);
VirtualFree (buffer, 0, MEM_RELEASE);
CloseHandle (hFileDest);
CloseHandle (hFileSrc);
nErrorLevel = 1;