diff options
| author | 2015-01-29 00:29:31 +0100 | |
|---|---|---|
| committer | 2015-01-29 00:29:31 +0100 | |
| commit | 2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39 (patch) | |
| tree | e1035f332e82141fbc0e7e454a532307696fca1a /tools | |
| parent | 66932417846c68add043d2d5129bcf40d3a5d08c (diff) | |
| download | libplist-2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39.tar.gz libplist-2731ec0c476eb8ecf2413b9a6c209fcf24ab4f39.tar.bz2 | |
plistutil: Plug some memory leaks
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/plistutil.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index 4c17ac7..6451604 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c | |||
| @@ -123,8 +123,10 @@ int main(int argc, char *argv[]) | |||
| 123 | 123 | ||
| 124 | // read input file | 124 | // read input file |
| 125 | iplist = fopen(options->in_file, "rb"); | 125 | iplist = fopen(options->in_file, "rb"); |
| 126 | if (!iplist) | 126 | if (!iplist) { |
| 127 | free(options); | ||
| 127 | return 1; | 128 | return 1; |
| 129 | } | ||
| 128 | 130 | ||
| 129 | stat(options->in_file, &filestats); | 131 | stat(options->in_file, &filestats); |
| 130 | plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1)); | 132 | plist_entire = (char *) malloc(sizeof(char) * (filestats.st_size + 1)); |
| @@ -150,8 +152,10 @@ int main(int argc, char *argv[]) | |||
| 150 | if (options->out_file != NULL) | 152 | if (options->out_file != NULL) |
| 151 | { | 153 | { |
| 152 | FILE *oplist = fopen(options->out_file, "wb"); | 154 | FILE *oplist = fopen(options->out_file, "wb"); |
| 153 | if (!oplist) | 155 | if (!oplist) { |
| 156 | free(options); | ||
| 154 | return 1; | 157 | return 1; |
| 158 | } | ||
| 155 | fwrite(plist_out, size, sizeof(char), oplist); | 159 | fwrite(plist_out, size, sizeof(char), oplist); |
| 156 | fclose(oplist); | 160 | fclose(oplist); |
| 157 | } | 161 | } |
