linzch3 opened a new pull request, #832: URL: https://github.com/apache/commons-compress/pull/832
Fixes [COMPRESS-729](https://issues.apache.org/jira/browse/COMPRESS-729). `close()` runs `destroy()` in its `finally` block, but `destroy()` only closed `out`. The Deflater was ended only as the last step of a successful `finish()`, so when `finish()` threw (target stream broken by a client abort, or an entry still open), the ~256 KB of native zlib memory stayed around until GC. `destroy()` now also calls `streamCompressor.close()` in a `finally`. `Deflater.end()` is idempotent, so the normal path is unchanged. Two tests in `ZipArchiveOutputStreamTest` cover the failing-target and unclosed-entry cases; both fail without the change. Not sure whether you want a `changes.xml` entry from contributors, happy to add one. - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project. - [x] Read the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) if you use Artificial Intelligence (AI). - [x] I used AI to create any part of, or all of, this pull request. An AI coding assistant helped draft the fix and the tests; I reviewed and verified them. - [x] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Each commit in the pull request should have a meaningful subject line and body. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
