Fix bug in gzclose_w() when gzwrite() fails to allocate memory.
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user