From 421c7a61f08ff255bf898f0e687b7d7c8fbdae77 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Thu, 8 Dec 2011 19:03:56 -0800 Subject: Have inflate() with Z_FINISH avoid the allocation of a window. inflate() avoided that allocation normally, until it was modified to update the window on a normal completion so that inflateResetKeep() could work. This patch restores that behavior, but only when Z_FINISH is used successfully to complete an inflation of a stream in a single call of inflate(). The comments in zlib.h have been updated accordingly. --- inflate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inflate.c') diff --git a/inflate.c b/inflate.c index 6832b8b..1523598 100644 --- a/inflate.c +++ b/inflate.c @@ -1232,7 +1232,8 @@ int flush; */ inf_leave: RESTORE(); - if (state->wsize || (state->mode < BAD && out != strm->avail_out)) + if (state->wsize || (out != strm->avail_out && state->mode < BAD && + (state->mode < CHECK || flush != Z_FINISH))) if (updatewindow(strm, out)) { state->mode = MEM; return Z_MEM_ERROR; -- cgit v1.2.3-55-g6feb