From: Oliver Stoeneberg [mailto:oliverst@online.de]

Sent: Wednesday, May 27, 2009 11:50 PM
To: submit@mamedev.org
Subject: Memory Leaks

This patch fixes a few potential memory leaks detected by cppcheck 
and also adds an errormessage to verinfo.
This commit is contained in:
Aaron Giles 2009-05-28 15:19:27 +00:00
parent 25895015b2
commit 03302fd9b9
2 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,7 @@ int main(int argc, char *argv[])
buffer = (unsigned char *)malloc(bytes + 1);
if (buffer == NULL)
{
fclose(src);
fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes);
return 1;
}
@ -75,6 +76,7 @@ int main(int argc, char *argv[])
dst = fopen(dstfile, "w");
if (dst == NULL)
{
free(buffer);
fprintf(stderr, "Unable to open output file '%s'\n", dstfile);
return 1;
}

View File

@ -248,7 +248,11 @@ int main(int argc, char *argv[])
// parse out version string
if (parse_version(buffer, &v.version_major, &v.version_minor, &v.version_build, &v.version_string))
{
free(buffer);
fprintf(stderr, "Error parsing version from '%s'\n", buffer);
return 1;
}
if (build == BUILD_MESS)
{