summaryrefslogtreecommitdiffstatshomepage
path: root/src/build
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-05-28 15:19:27 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-05-28 15:19:27 +0000
commit03302fd9b9aa5eddd4b3300d9dae79bffdd54c8a (patch)
treefaa6d90f2a27e3deb5efd7659bddfc9f5a97ac1a /src/build
parent25895015b255162363afaa29333a7ccd4d5e2c09 (diff)
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.
Diffstat (limited to 'src/build')
-rw-r--r--src/build/file2str.c2
-rw-r--r--src/build/verinfo.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/build/file2str.c b/src/build/file2str.c
index 7e2ae02746c..7964ea977ee 100644
--- a/src/build/file2str.c
+++ b/src/build/file2str.c
@@ -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;
}
diff --git a/src/build/verinfo.c b/src/build/verinfo.c
index 00646ef4b7a..2cbf41a3ac7 100644
--- a/src/build/verinfo.c
+++ b/src/build/verinfo.c
@@ -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)
{