summaryrefslogtreecommitdiffstats
path: root/plutil/plutil.c
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 /plutil/plutil.c
parent6f7a0ffe801380c83af1855138f856fc4efeef56 (diff)
downloadlibplist-ae1478e2761273f18a7736427c8a88782015bd03.tar.gz
libplist-ae1478e2761273f18a7736427c8a88782015bd03.tar.bz2
Plug a few memory leaks in plutil
Diffstat (limited to 'plutil/plutil.c')
-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[])
40 40
41 if (!options) { 41 if (!options) {
42 print_usage(); 42 print_usage();
43 free(filestats);
43 return 0; 44 return 0;
44 } 45 }
45 //read input file 46 //read input file
@@ -62,6 +63,9 @@ int main(int argc, char *argv[])
62 plist_from_xml(plist_entire, filestats->st_size, &root_node); 63 plist_from_xml(plist_entire, filestats->st_size, &root_node);
63 plist_to_bin(root_node, &plist_out, &size); 64 plist_to_bin(root_node, &plist_out, &size);
64 } 65 }
66 plist_free(root_node);
67 free(plist_entire);
68 free(filestats);
65 69
66 if (plist_out) { 70 if (plist_out) {
67 if (options->out_file != NULL) { 71 if (options->out_file != NULL) {
@@ -74,8 +78,12 @@ int main(int argc, char *argv[])
74 //if no output file specified, write to stdout 78 //if no output file specified, write to stdout
75 else 79 else
76 fwrite(plist_out, size, sizeof(char), stdout); 80 fwrite(plist_out, size, sizeof(char), stdout);
81
82 free(plist_out);
77 } else 83 } else
78 printf("ERROR\n"); 84 printf("ERROR\n");
85
86 free(options);
79 return 0; 87 return 0;
80} 88}
81 89