Fix bug in gzclose_w() when gzwrite() fails to allocate memory.

pull/3/head^2
Mark Adler 13 years ago
parent dab7531ecc
commit 53bfe01cea
  1. 2
      gzwrite.c

@ -547,6 +547,7 @@ int ZEXPORT gzclose_w(file)
} }
/* flush, free memory, and close file */ /* flush, free memory, and close file */
if (state->size) {
if (gz_comp(state, Z_FINISH) == -1) if (gz_comp(state, Z_FINISH) == -1)
ret = state->err; ret = state->err;
if (!state->direct) { if (!state->direct) {
@ -554,6 +555,7 @@ int ZEXPORT gzclose_w(file)
free(state->out); free(state->out);
} }
free(state->in); free(state->in);
}
gz_error(state, Z_OK, NULL); gz_error(state, Z_OK, NULL);
free(state->path); free(state->path);
if (close(state->fd) == -1) if (close(state->fd) == -1)

Loading…
Cancel
Save