diff options
author | 2013-01-22 22:43:33 +0000 | |
---|---|---|
committer | 2013-01-22 22:43:33 +0000 | |
commit | 0c55ccfd295cd5a139e0f4f37a3373ebbf85634a (patch) | |
tree | 13f9818fcabdb6fe37027a299e33b7a2290f9634 /src/tools/jedutil.c | |
parent | 4b71062764813afefc16107b742cc3e09a87874e (diff) |
fixed memory leak in jedutil (nw)
Diffstat (limited to 'src/tools/jedutil.c')
-rw-r--r-- | src/tools/jedutil.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/jedutil.c b/src/tools/jedutil.c index f6b5ba158f1..050da77b64f 100644 --- a/src/tools/jedutil.c +++ b/src/tools/jedutil.c @@ -3338,7 +3338,10 @@ static int command_convert(int argc, char *argv[]) /* read the source file */ err = read_source_file(srcfile); if (err != 0) + { + free(srcbuf); return 1; + } memset(&jed, 0, sizeof(jed)); @@ -3374,6 +3377,7 @@ static int command_convert(int argc, char *argv[]) if (!dstbuf) { fprintf(stderr, "Unable to allocate %d bytes for the target buffer!\n", (int)dstbuflen); + free(srcbuf); return 1; } dstbuflen = jedbin_output(&jed, dstbuf, dstbuflen); @@ -3401,6 +3405,7 @@ static int command_convert(int argc, char *argv[]) if (!dstbuf) { fprintf(stderr, "Unable to allocate %d bytes for the target buffer!\n", (int)dstbuflen); + free(srcbuf); return 1; } dstbuflen = jed_output(&jed, dstbuf, dstbuflen); @@ -3408,6 +3413,7 @@ static int command_convert(int argc, char *argv[]) /* write the destination file */ err = write_dest_file(dstfile); + free(srcbuf); if (err != 0) return 1; @@ -3453,7 +3459,10 @@ static int command_view(int argc, char *argv[]) /* read the source file */ err = read_source_file(srcfile); if (err != 0) + { + free(srcbuf); return 1; + } /* if the source is JED, convert to binary */ if (is_jed) @@ -3488,10 +3497,11 @@ static int command_view(int argc, char *argv[]) else { fprintf(stderr, "Viewing product terms not supported for this pal type."); - + free(srcbuf); return 1; } + free(srcbuf); return 0; } |