diff --git a/gzwrite.c b/gzwrite.c index f53aace491186bd4444d37bdd832307fb34fa218..79a69a5cd2fe3586500f41b856bd42ba8c90ab32 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -554,15 +554,14 @@ int ZEXPORT gzclose_w(file) } /* flush, free memory, and close file */ - if (state->size) { - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; - if (!state->direct) { - (void)deflateEnd(&(state->strm)); - free(state->out); - } - free(state->in); + if (gz_comp(state, Z_FINISH) == -1) + ret = state->err; + if (!state->direct) { + (void)deflateEnd(&(state->strm)); + free(state->out); } + if (state->size) + free(state->in); gz_error(state, Z_OK, NULL); free(state->path); if (close(state->fd) == -1)