mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[CMD]
Don't leak memory on realloc failure svn path=/trunk/; revision=58535
This commit is contained in:
parent
db5a7755ce
commit
58a33cba17
|
@ -377,11 +377,15 @@ INT cmd_copy(LPTSTR param)
|
|||
|
||||
if (size > 512)
|
||||
{
|
||||
TCHAR *old_evar = evar;
|
||||
evar = cmd_realloc(evar,size * sizeof(TCHAR) );
|
||||
if (evar!=NULL)
|
||||
size = GetEnvironmentVariable (_T("COPYCMD"), evar, size);
|
||||
else
|
||||
{
|
||||
size=0;
|
||||
evar = old_evar;
|
||||
}
|
||||
}
|
||||
|
||||
/* check see if we did get any env variable */
|
||||
|
|
|
@ -666,6 +666,8 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
|
|||
/* aseemble a list of all files names */
|
||||
do
|
||||
{
|
||||
FileName * oldFileList = FileList;
|
||||
|
||||
if(!_tcscmp (file.cFileName, _T(".")) ||
|
||||
!_tcscmp (file.cFileName, _T("..")))
|
||||
continue;
|
||||
|
@ -683,6 +685,8 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
|
|||
|
||||
if(FileList == NULL)
|
||||
{
|
||||
/* Don't leak old buffer */
|
||||
cmd_free(oldFileList);
|
||||
/* Assemble the orginal string and return */
|
||||
_tcscpy(strOut,szOrginal);
|
||||
FindClose(hFile);
|
||||
|
|
Loading…
Reference in a new issue