diff --git a/deflate.c b/deflate.c index 7a9e05e..544521d 100644 --- a/deflate.c +++ b/deflate.c @@ -676,7 +676,7 @@ int ZEXPORT deflate (strm, flush) s = strm->state; 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)) { ERR_RETURN(strm, Z_STREAM_ERROR); } diff --git a/gzwrite.c b/gzwrite.c index ad164b2..efff93a 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -47,6 +47,7 @@ local int gz_init(state) gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } + strm->next_in = NULL; } /* mark state as initialized */