If MT brotli compression/decompression stops unexpectedly or after canceling, for instance in error case by write, if it was cut or by partial extraction, they may leak:
because of return that bypass cleanup (affected only extract with -mmt1)
because some entries may still remain in writelist_done or writelist_busy lists and they, in contrast to writelist_free list, will not be freed (so leaking with wl but also large buffer blocks wl->out.buf);
This fix removes possible memory leakage in such cases.
If MT brotli compression/decompression stops unexpectedly or after canceling, for instance in error case by write, if it was cut or by partial extraction, they may leak:
-mmt1
)writelist_done
orwritelist_busy
lists and they, in contrast towritelist_free
list, will not be freed (so leaking withwl
but also large buffer blockswl->out.buf
);This fix removes possible memory leakage in such cases.
In addition this PR has a small code deduplication (in brotli-mt_decompress.c:366-371).