summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-04-24 17:01:23 +0200
committerGravatar Jonathan Beck2009-04-27 19:35:48 +0200
commitae1478e2761273f18a7736427c8a88782015bd03 (patch)
tree786bacb0da3f24739bbef776bee0333c5edb6d29
parent6f7a0ffe801380c83af1855138f856fc4efeef56 (diff)
downloadlibplist-ae1478e2761273f18a7736427c8a88782015bd03.tar.gz
libplist-ae1478e2761273f18a7736427c8a88782015bd03.tar.bz2
Plug a few memory leaks in plutil
-rw-r--r--plutil/plutil.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/plutil/plutil.c b/plutil/plutil.c
index 37d83df..8c2245c 100644
--- a/plutil/plutil.c
+++ b/plutil/plutil.c
@@ -40,6 +40,7 @@ int main(int argc, char *argv[])
if (!options) {
print_usage();
+ free(filestats);
return 0;
}
//read input file
@@ -62,6 +63,9 @@ int main(int argc, char *argv[])
plist_from_xml(plist_entire, filestats->st_size, &root_node);
plist_to_bin(root_node, &plist_out, &size);
}
+ plist_free(root_node);
+ free(plist_entire);
+ free(filestats);
if (plist_out) {
if (options->out_file != NULL) {
@@ -74,8 +78,12 @@ int main(int argc, char *argv[])
//if no output file specified, write to stdout
else
fwrite(plist_out, size, sizeof(char), stdout);
+
+ free(plist_out);
} else
printf("ERROR\n");
+
+ free(options);
return 0;
}