mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +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"));
|
_tcscat(TempSrc,_T(".decrypt"));
|
||||||
if (!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
|
if (!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
|
||||||
{
|
{
|
||||||
|
CloseHandle (hFileSrc);
|
||||||
nErrorLevel = 1;
|
nErrorLevel = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -766,6 +767,7 @@ INT cmd_copy(LPTSTR param)
|
||||||
/* Check Breaker */
|
/* Check Breaker */
|
||||||
if (CheckCtrlBreak(BREAK_INPUT))
|
if (CheckCtrlBreak(BREAK_INPUT))
|
||||||
{
|
{
|
||||||
|
FindClose(hFile);
|
||||||
freep(arg);
|
freep(arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -789,6 +791,7 @@ INT cmd_copy(LPTSTR param)
|
||||||
if (_tcscmp(tmpDestPath, _T("\\\\.\\")) &&
|
if (_tcscmp(tmpDestPath, _T("\\\\.\\")) &&
|
||||||
!IsExistingDirectory(tmpDestPath))
|
!IsExistingDirectory(tmpDestPath))
|
||||||
{
|
{
|
||||||
|
FindClose(hFile);
|
||||||
ConOutFormatMessage(GetLastError(), szSrcPath);
|
ConOutFormatMessage(GetLastError(), szSrcPath);
|
||||||
freep(arg);
|
freep(arg);
|
||||||
nErrorLevel = 1;
|
nErrorLevel = 1;
|
||||||
|
|
|
@ -382,7 +382,10 @@ BOOL DeleteFolder(LPTSTR FileName)
|
||||||
{
|
{
|
||||||
SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
|
SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
|
||||||
if (!DeleteFile(TempFileName))
|
if (!DeleteFile(TempFileName))
|
||||||
|
{
|
||||||
|
FindClose (hFile);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}while (FindNextFile (hFile, &f));
|
}while (FindNextFile (hFile, &f));
|
||||||
|
|
|
@ -100,7 +100,7 @@ INT cmd_move (LPTSTR param)
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
|
|
||||||
/* used only when source and destination directories are on different volume */
|
/* used only when source and destination directories are on different volume */
|
||||||
HANDLE hDestFile;
|
HANDLE hDestFile = NULL;
|
||||||
WIN32_FIND_DATA findDestBuffer;
|
WIN32_FIND_DATA findDestBuffer;
|
||||||
TCHAR szMoveDest[MAX_PATH];
|
TCHAR szMoveDest[MAX_PATH];
|
||||||
TCHAR szMoveSrc[MAX_PATH];
|
TCHAR szMoveSrc[MAX_PATH];
|
||||||
|
@ -505,6 +505,9 @@ INT cmd_move (LPTSTR param)
|
||||||
FindNextFile (hFile, &findBuffer));
|
FindNextFile (hFile, &findBuffer));
|
||||||
FindClose (hFile);
|
FindClose (hFile);
|
||||||
|
|
||||||
|
if(hDestFile && hDestFile != INVALID_HANDLE_VALUE)
|
||||||
|
FindClose(hDestFile);
|
||||||
|
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,10 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
|
||||||
else
|
else
|
||||||
ConOutResPrintf(STRING_REPLACE_HELP10, dest);
|
ConOutResPrintf(STRING_REPLACE_HELP10, dest);
|
||||||
if ( !FilePromptYNA (0))
|
if ( !FilePromptYNA (0))
|
||||||
|
{
|
||||||
|
CloseHandle (hFileSrc);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output depending on add flag */
|
/* Output depending on add flag */
|
||||||
|
@ -220,7 +223,7 @@ INT recReplace(DWORD dwFlags,
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
WIN32_FIND_DATA findBuffer;
|
WIN32_FIND_DATA findBuffer;
|
||||||
|
|
||||||
/* Get file handel to the sourcefile(s) */
|
/* Get file handle to the sourcefile(s) */
|
||||||
hFile = FindFirstFile (szSrcPath, &findBuffer);
|
hFile = FindFirstFile (szSrcPath, &findBuffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -302,6 +305,8 @@ INT recReplace(DWORD dwFlags,
|
||||||
/* Take next sourcefile if any */
|
/* Take next sourcefile if any */
|
||||||
} while(FindNextFile (hFile, &findBuffer));
|
} while(FindNextFile (hFile, &findBuffer));
|
||||||
|
|
||||||
|
FindClose(hFile);
|
||||||
|
|
||||||
return filesReplaced;
|
return filesReplaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +383,8 @@ INT recFindSubDirs(DWORD dwFlags,
|
||||||
/* Get the next handle */
|
/* Get the next handle */
|
||||||
} while(FindNextFile (hFile, &findBuffer));
|
} while(FindNextFile (hFile, &findBuffer));
|
||||||
|
|
||||||
|
FindClose(hFile);
|
||||||
|
|
||||||
return filesReplaced;
|
return filesReplaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue