mirror of
https://github.com/holub/mame
synced 2025-05-07 14:54:35 +03:00
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:
parent
25895015b2
commit
03302fd9b9
@ -62,6 +62,7 @@ int main(int argc, char *argv[])
|
|||||||
buffer = (unsigned char *)malloc(bytes + 1);
|
buffer = (unsigned char *)malloc(bytes + 1);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
{
|
{
|
||||||
|
fclose(src);
|
||||||
fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes);
|
fprintf(stderr, "Out of memory allocating %d byte buffer\n", bytes);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -75,6 +76,7 @@ int main(int argc, char *argv[])
|
|||||||
dst = fopen(dstfile, "w");
|
dst = fopen(dstfile, "w");
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
{
|
{
|
||||||
|
free(buffer);
|
||||||
fprintf(stderr, "Unable to open output file '%s'\n", dstfile);
|
fprintf(stderr, "Unable to open output file '%s'\n", dstfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// parse out version string
|
// parse out version string
|
||||||
if (parse_version(buffer, &v.version_major, &v.version_minor, &v.version_build, &v.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;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (build == BUILD_MESS)
|
if (build == BUILD_MESS)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user