Author: pschweitzer
Date: Thu Oct 6 20:45:06 2011
New Revision: 54033
URL:
http://svn.reactos.org/svn/reactos?rev=54033&view=rev
Log:
[PEDUMP]
Fix memory & resource leaks
Modified:
trunk/rosapps/applications/sysutils/pedump/pedump.c
Modified: trunk/rosapps/applications/sysutils/pedump/pedump.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/pedu…
==============================================================================
--- trunk/rosapps/applications/sysutils/pedump/pedump.c [iso-8859-1] (original)
+++ trunk/rosapps/applications/sysutils/pedump/pedump.c [iso-8859-1] Thu Oct 6 20:45:06
2011
@@ -4014,6 +4014,7 @@
"%s: can not allocate memory.\n",
argv[0]
);
+ fclose(my_fp);
exit (0);
}
/*
@@ -4022,6 +4023,7 @@
printf ("\n\nDump of file: %s\n\n", argv[1]);
n = fread (lpFile, fsize, 1, my_fp);
+ fclose(my_fp);
if (n == -1)
{
@@ -4030,6 +4032,7 @@
argv[0],
argv[1]
);
+ free(lpFile);
exit (0);
}
@@ -4045,6 +4048,7 @@
"%s: This file is not in PE format; it looks like in DOS format.\n",
argv[0]
);
+ free(lpFile);
exit (0);
}
}
@@ -4055,6 +4059,7 @@
argv[0],
dosHdr.e_magic
);
+ free(lpFile);
exit (0);
}
@@ -4067,6 +4072,7 @@
argv[0],
fileType
);
+ free(lpFile);
exit (0);
}
@@ -4087,7 +4093,10 @@
entryPoint = poh->AddressOfEntryPoint;
if (psh == NULL)
+ {
+ free(lpFile);
return 0;
+ }
/* store section headers */