Author: pschweitzer
Date: Sun Mar 17 11:06:37 2013
New Revision: 58533
URL:
http://svn.reactos.org/svn/reactos?rev=58533&view=rev
Log:
[CMD]
Fix potential memory leaks
Modified:
trunk/reactos/base/shell/cmd/filecomp.c
Modified: trunk/reactos/base/shell/cmd/filecomp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/filecomp.c?…
==============================================================================
--- trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] Sun Mar 17 11:06:37 2013
@@ -491,9 +491,15 @@
INT ret;
File1 = cmd_alloc(sizeof(FileName));
+ if (!File1)
+ return 0;
+
File2 = cmd_alloc(sizeof(FileName));
- if(!File1 || !File2)
+ if(!File2)
+ {
+ cmd_free(File1);
return 0;
+ }
memcpy(File1,arg1,sizeof(FileName));
memcpy(File2,arg2,sizeof(FileName));
@@ -666,8 +672,8 @@
/* Don't show files when they are doing 'cd' or 'rd' */
if(!ShowAll &&
- file.dwFileAttributes != 0xFFFFFFFF &&
- !(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ file.dwFileAttributes != 0xFFFFFFFF &&
+ !(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
continue;
}
@@ -688,7 +694,7 @@
} while(FindNextFile(hFile,&file));
- FindClose(hFile);
+ FindClose(hFile);
/* Check the size of the list to see if we
found any matches */