diff options
-rw-r--r-- | tools/plistutil.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index fc0d7c0..4c17ac7 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c @@ -112,13 +112,12 @@ int main(int argc, char *argv[]) uint32_t size = 0; int read_size = 0; char *plist_entire = NULL; - struct stat *filestats = (struct stat *) malloc(sizeof(struct stat)); + struct stat filestats; options_t *options = parse_arguments(argc, argv); if (!options) { print_usage(argc, argv); - free(filestats); return 0; } @@ -127,9 +126,9 @@ int main(int argc, char *argv[]) if (!iplist) return 1; - stat(options->in_file, filestats); - plist_entire = (char *) malloc(sizeof(char) * (filestats->st_size + 1)); - read_size = fread(plist_entire, sizeof(char), filestats->st_size, iplist); + stat(options->in_file, &filestats); + plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1)); + read_size = fread(plist_entire, sizeof(char), filestats.st_size, iplist); fclose(iplist); // convert from binary to xml or vice-versa @@ -145,7 +144,6 @@ int main(int argc, char *argv[]) } plist_free(root_node); free(plist_entire); - free(filestats); if (plist_out) { |