diff options
Diffstat (limited to '')
| -rw-r--r-- | gzwrite.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -556,12 +556,13 @@ int ZEXPORT gzclose_w(file) | |||
| 556 | /* flush, free memory, and close file */ | 556 | /* flush, free memory, and close file */ |
| 557 | if (gz_comp(state, Z_FINISH) == -1) | 557 | if (gz_comp(state, Z_FINISH) == -1) |
| 558 | ret = state->err; | 558 | ret = state->err; |
| 559 | if (!state->direct) { | 559 | if (state->size) { |
| 560 | (void)deflateEnd(&(state->strm)); | 560 | if (!state->direct) { |
| 561 | free(state->out); | 561 | (void)deflateEnd(&(state->strm)); |
| 562 | } | 562 | free(state->out); |
| 563 | if (state->size) | 563 | } |
| 564 | free(state->in); | 564 | free(state->in); |
| 565 | } | ||
| 565 | gz_error(state, Z_OK, NULL); | 566 | gz_error(state, Z_OK, NULL); |
| 566 | free(state->path); | 567 | free(state->path); |
| 567 | if (close(state->fd) == -1) | 568 | if (close(state->fd) == -1) |
