diff options
author | Nikias Bassen | 2015-01-29 00:26:59 +0100 |
---|---|---|
committer | Nikias Bassen | 2015-01-29 00:26:59 +0100 |
commit | 66932417846c68add043d2d5129bcf40d3a5d08c (patch) | |
tree | 5d2ad259eb7162a9cf1e7e4003431c66f2d9015d /tools | |
parent | 801a72a39b9a41ab0d3aa018a740d1a813b5420c (diff) | |
download | libplist-66932417846c68add043d2d5129bcf40d3a5d08c.tar.gz libplist-66932417846c68add043d2d5129bcf40d3a5d08c.tar.bz2 |
plistutil: Use static buffer for stat()
Diffstat (limited to 'tools')
-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) { |