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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user