Fix bug in gzclose_w() when gzwrite() fails to allocate memory.
This commit is contained in:
14
gzwrite.c
14
gzwrite.c
@@ -547,13 +547,15 @@ int ZEXPORT gzclose_w(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* flush, free memory, and close file */
|
/* flush, free memory, and close file */
|
||||||
if (gz_comp(state, Z_FINISH) == -1)
|
if (state->size) {
|
||||||
ret = state->err;
|
if (gz_comp(state, Z_FINISH) == -1)
|
||||||
if (!state->direct) {
|
ret = state->err;
|
||||||
(void)deflateEnd(&(state->strm));
|
if (!state->direct) {
|
||||||
free(state->out);
|
(void)deflateEnd(&(state->strm));
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user