mirror of
https://github.com/reactos/reactos.git
synced 2024-06-27 16:31:30 +00:00
[CMD]
- Fix mismatched allocation/free. Spotted by Samuel & cppcheck CORE-8207 #resolve svn path=/trunk/; revision=63249
This commit is contained in:
parent
76f9d532f2
commit
dbe30dfb59
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue