2010-02-28 Ozkan Sezer <sezeroz@gmail.com>

Back-merges from the trunk:

	2010-02-23  Kai Tietz  <kai.tietz@onevision.com>
	* src/gendef.c: Fix crash on none PE(+) images. (r1933)

	2010-02-28  Ozkan Sezer  <sezeroz@gmail.com>
	* src/gendef.c: always set gDta to NULL after freeing it. (r1965)


git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/branches/releases/v1.0@1966 4407c894-4637-0410-b4f5-ada5f102cad1
This commit is contained in:
Ozkan Sezer 2010-02-28 13:42:19 +00:00
parent 52df15fe5c
commit 14b486e5ee
2 changed files with 32 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2010-02-28 Ozkan Sezer <sezeroz@gmail.com>
Back-merges from the trunk:
2010-02-23 Kai Tietz <kai.tietz@onevision.com>
* src/gendef.c: Fix crash on none PE(+) images. (r1933)
2010-02-28 Ozkan Sezer <sezeroz@gmail.com>
* src/gendef.c: always set gDta to NULL after freeing it. (r1965)
2009-12-10 Kai Tietz <kai.tietz@onevision.com>
Merged from trunk.

View File

@ -227,7 +227,8 @@ int main(int argc,char **argv)
fninput = opt->fninput;
fnoutput = opt->fnoutput;
load_pep();
if (load_pep ())
{
if (gPEDta || gPEPDta)
{
if (gPEDta)
@ -236,10 +237,15 @@ int main(int argc,char **argv)
do_pepdef ();
dump_def ();
}
}
if (fndllname)
free (fndllname);
fndllname = NULL;
if (gDta)
{
free (gDta);
gDta = NULL;
}
free(opt->fninput);
free(opt->fnoutput);
free(opt);
@ -288,6 +294,7 @@ load_pep(void)
{
fprintf(stderr,"*** [%s] not a PE(+) file\n", fninput);
free(gDta);
gDta = NULL;
return 0;
}
gPEDta = (PIMAGE_NT_HEADERS32) &gDta[gMZDta->e_lfanew];
@ -296,6 +303,9 @@ load_pep(void)
{
fprintf (stderr, "*** [%s] no PE(+) signature\n", fninput);
free (gDta);
gDta = NULL;
gPEPDta = NULL;
gPEDta = NULL;
return 0;
}
if (gPEDta->FileHeader.SizeOfOptionalHeader == IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
@ -313,7 +323,10 @@ load_pep(void)
else
{
free (gDta);
gDta = NULL;
fprintf (stderr, "*** [%s] no PE(+) optional header\n", fninput);
gPEPDta = NULL;
gPEDta = NULL;
return 0;
}
return 1;