aboutsummaryrefslogtreecommitdiff
path: root/gzwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'gzwrite.c')
-rw-r--r--gzwrite.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gzwrite.c b/gzwrite.c
index 79a69a5..1b06cdd 100644
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -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)