]> git.ipfire.org Git - thirdparty/libarchive.git/commit
write_add_filter_bzip2: End compression in the freer
authorDag-Erling Smørgrav <des@des.no>
Mon, 8 Sep 2025 19:20:32 +0000 (21:20 +0200)
committerDag-Erling Smørgrav <des@des.no>
Mon, 8 Sep 2025 21:33:32 +0000 (23:33 +0200)
commit3a072e0bb0d6084dd0741440d31896a314d1f2ea
treeb9136d98a26b9ee23b03a9e7e3e189289248795d
parent06191cd28765cf492c32cd0069737c629955f84d
write_add_filter_bzip2: End compression in the freer

If a fatal error occurs, the closer will not be called, so neither will
BZ2_bzCompressEnd(), and we will leak memory.  Fix this by calling it a
second time from the freer.  This is harmless in the non-error case as
it will see that the compression state has already been cleared and
immediately return BZ_PARAM_ERROR, which we simply ignore.
libarchive/archive_write_add_filter_bzip2.c
libarchive/test/test_write_filter_bzip2.c