mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:12:59 +00:00
[CMD]
Fix potential memory leaks svn path=/trunk/; revision=58533
This commit is contained in:
parent
75d957b8e6
commit
c03ac4615e
1 changed files with 11 additions and 5 deletions
|
@ -491,10 +491,16 @@ int __cdecl compare(const void *arg1,const void *arg2)
|
||||||
INT ret;
|
INT ret;
|
||||||
|
|
||||||
File1 = cmd_alloc(sizeof(FileName));
|
File1 = cmd_alloc(sizeof(FileName));
|
||||||
File2 = cmd_alloc(sizeof(FileName));
|
if (!File1)
|
||||||
if(!File1 || !File2)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
File2 = cmd_alloc(sizeof(FileName));
|
||||||
|
if(!File2)
|
||||||
|
{
|
||||||
|
cmd_free(File1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(File1,arg1,sizeof(FileName));
|
memcpy(File1,arg1,sizeof(FileName));
|
||||||
memcpy(File2,arg2,sizeof(FileName));
|
memcpy(File2,arg2,sizeof(FileName));
|
||||||
|
|
||||||
|
@ -666,8 +672,8 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
|
||||||
|
|
||||||
/* Don't show files when they are doing 'cd' or 'rd' */
|
/* Don't show files when they are doing 'cd' or 'rd' */
|
||||||
if(!ShowAll &&
|
if(!ShowAll &&
|
||||||
file.dwFileAttributes != 0xFFFFFFFF &&
|
file.dwFileAttributes != 0xFFFFFFFF &&
|
||||||
!(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
!(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -688,7 +694,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
|
||||||
|
|
||||||
} while(FindNextFile(hFile,&file));
|
} while(FindNextFile(hFile,&file));
|
||||||
|
|
||||||
FindClose(hFile);
|
FindClose(hFile);
|
||||||
|
|
||||||
/* Check the size of the list to see if we
|
/* Check the size of the list to see if we
|
||||||
found any matches */
|
found any matches */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue