summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2015-01-29 00:29:31 +0100
committerGravatar Nikias Bassen2015-01-29 00:29:31 +0100
commit2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39 (patch)
treee1035f332e82141fbc0e7e454a532307696fca1a
parent66932417846c68add043d2d5129bcf40d3a5d08c (diff)
downloadlibplist-2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39.tar.gz
libplist-2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39.tar.bz2
plistutil: Plug some memory leaks
-rw-r--r--tools/plistutil.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c
index 4c17ac7..6451604 100644
--- a/tools/plistutil.c
+++ b/tools/plistutil.c
@@ -123,8 +123,10 @@ int main(int argc, char *argv[])
// read input file
iplist = fopen(options->in_file, "rb");
- if (!iplist)
+ if (!iplist) {
+ free(options);
return 1;
+ }
stat(options->in_file, &filestats);
plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1));
@@ -150,8 +152,10 @@ int main(int argc, char *argv[])
if (options->out_file != NULL)
{
FILE *oplist = fopen(options->out_file, "wb");
- if (!oplist)
+ if (!oplist) {
+ free(options);
return 1;
+ }
fwrite(plist_out, size, sizeof(char), oplist);
fclose(oplist);
}