Avoid uninitialized access by gzclose_w().

This commit is contained in:
Mark Adler 2015-07-28 23:13:53 -07:00
parent 51a223def4
commit c901a34c92
2 changed files with 2 additions and 1 deletions

View File

@ -676,7 +676,7 @@ int ZEXPORT deflate (strm, flush)
s = strm->state; s = strm->state;
if (strm->next_out == Z_NULL || if (strm->next_out == Z_NULL ||
(strm->next_in == Z_NULL && strm->avail_in != 0) || (strm->avail_in != 0 && strm->next_in == Z_NULL) ||
(s->status == FINISH_STATE && flush != Z_FINISH)) { (s->status == FINISH_STATE && flush != Z_FINISH)) {
ERR_RETURN(strm, Z_STREAM_ERROR); ERR_RETURN(strm, Z_STREAM_ERROR);
} }

View File

@ -47,6 +47,7 @@ local int gz_init(state)
gz_error(state, Z_MEM_ERROR, "out of memory"); gz_error(state, Z_MEM_ERROR, "out of memory");
return -1; return -1;
} }
strm->next_in = NULL;
} }
/* mark state as initialized */ /* mark state as initialized */