mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[CMD]
- fix resource leaks CID 716324, 716323, 716322, 716321, 716320, 716319, 716318 svn path=/trunk/; revision=64871
This commit is contained in:
parent
8d45f7ba25
commit
cd1f57b5d4
4 changed files with 18 additions and 2 deletions
|
@ -136,6 +136,7 @@ copy(TCHAR source[MAX_PATH],
|
|||
_tcscat(TempSrc,_T(".decrypt"));
|
||||
if (!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
|
||||
{
|
||||
CloseHandle (hFileSrc);
|
||||
nErrorLevel = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -766,6 +767,7 @@ INT cmd_copy(LPTSTR param)
|
|||
/* Check Breaker */
|
||||
if (CheckCtrlBreak(BREAK_INPUT))
|
||||
{
|
||||
FindClose(hFile);
|
||||
freep(arg);
|
||||
return 1;
|
||||
}
|
||||
|
@ -789,6 +791,7 @@ INT cmd_copy(LPTSTR param)
|
|||
if (_tcscmp(tmpDestPath, _T("\\\\.\\")) &&
|
||||
!IsExistingDirectory(tmpDestPath))
|
||||
{
|
||||
FindClose(hFile);
|
||||
ConOutFormatMessage(GetLastError(), szSrcPath);
|
||||
freep(arg);
|
||||
nErrorLevel = 1;
|
||||
|
|
|
@ -382,7 +382,10 @@ BOOL DeleteFolder(LPTSTR FileName)
|
|||
{
|
||||
SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
|
||||
if (!DeleteFile(TempFileName))
|
||||
{
|
||||
FindClose (hFile);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}while (FindNextFile (hFile, &f));
|
||||
|
|
|
@ -100,7 +100,7 @@ INT cmd_move (LPTSTR param)
|
|||
HANDLE hFile;
|
||||
|
||||
/* used only when source and destination directories are on different volume */
|
||||
HANDLE hDestFile;
|
||||
HANDLE hDestFile = NULL;
|
||||
WIN32_FIND_DATA findDestBuffer;
|
||||
TCHAR szMoveDest[MAX_PATH];
|
||||
TCHAR szMoveSrc[MAX_PATH];
|
||||
|
@ -505,6 +505,9 @@ INT cmd_move (LPTSTR param)
|
|||
FindNextFile (hFile, &findBuffer));
|
||||
FindClose (hFile);
|
||||
|
||||
if(hDestFile && hDestFile != INVALID_HANDLE_VALUE)
|
||||
FindClose(hDestFile);
|
||||
|
||||
freep (arg);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,10 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
|||
else
|
||||
ConOutResPrintf(STRING_REPLACE_HELP10, dest);
|
||||
if ( !FilePromptYNA (0))
|
||||
{
|
||||
CloseHandle (hFileSrc);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Output depending on add flag */
|
||||
|
@ -220,7 +223,7 @@ INT recReplace(DWORD dwFlags,
|
|||
HANDLE hFile;
|
||||
WIN32_FIND_DATA findBuffer;
|
||||
|
||||
/* Get file handel to the sourcefile(s) */
|
||||
/* Get file handle to the sourcefile(s) */
|
||||
hFile = FindFirstFile (szSrcPath, &findBuffer);
|
||||
|
||||
/*
|
||||
|
@ -302,6 +305,8 @@ INT recReplace(DWORD dwFlags,
|
|||
/* Take next sourcefile if any */
|
||||
} while(FindNextFile (hFile, &findBuffer));
|
||||
|
||||
FindClose(hFile);
|
||||
|
||||
return filesReplaced;
|
||||
}
|
||||
|
||||
|
@ -378,6 +383,8 @@ INT recFindSubDirs(DWORD dwFlags,
|
|||
/* Get the next handle */
|
||||
} while(FindNextFile (hFile, &findBuffer));
|
||||
|
||||
FindClose(hFile);
|
||||
|
||||
return filesReplaced;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue