Commit ae1478e2 authored by Martin Szulecki's avatar Martin Szulecki Committed by Jonathan Beck

Plug a few memory leaks in plutil

parent 6f7a0ffe
...@@ -40,6 +40,7 @@ int main(int argc, char *argv[]) ...@@ -40,6 +40,7 @@ int main(int argc, char *argv[])
if (!options) { if (!options) {
print_usage(); print_usage();
free(filestats);
return 0; return 0;
} }
//read input file //read input file
...@@ -62,6 +63,9 @@ int main(int argc, char *argv[]) ...@@ -62,6 +63,9 @@ int main(int argc, char *argv[])
plist_from_xml(plist_entire, filestats->st_size, &root_node); plist_from_xml(plist_entire, filestats->st_size, &root_node);
plist_to_bin(root_node, &plist_out, &size); plist_to_bin(root_node, &plist_out, &size);
} }
plist_free(root_node);
free(plist_entire);
free(filestats);
if (plist_out) { if (plist_out) {
if (options->out_file != NULL) { if (options->out_file != NULL) {
...@@ -74,8 +78,12 @@ int main(int argc, char *argv[]) ...@@ -74,8 +78,12 @@ int main(int argc, char *argv[])
//if no output file specified, write to stdout //if no output file specified, write to stdout
else else
fwrite(plist_out, size, sizeof(char), stdout); fwrite(plist_out, size, sizeof(char), stdout);
free(plist_out);
} else } else
printf("ERROR\n"); printf("ERROR\n");
free(options);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment