diff options
author | Jia Tan <jiat0218@gmail.com> | 2023-05-10 22:38:59 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-07-17 23:34:55 +0800 |
commit | f86ede22500f7ae024ec3ec3f3489ab5a857a3b3 (patch) | |
tree | 0bacab0de2bd93bd53e83153cc65788df361cd90 /src/xz | |
parent | xz: Add a message if --block-list is used outside of xz compresssion. (diff) | |
download | xz-f86ede22500f7ae024ec3ec3f3489ab5a857a3b3.tar.xz |
xz: Free filters[] in debug mode.
This will only free filter chains created with --filters1-9 since the
default filter chain may be set from a static function variable. The
complexity to free the default filter chain is not worth the burden on
code maintenance.
Diffstat (limited to 'src/xz')
-rw-r--r-- | src/xz/coder.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c index 476a5606..55e59c48 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -1245,6 +1245,16 @@ coder_run(const char *filename) extern void coder_free(void) { + // Free starting from the second filter chain since the default + // filter chain may have its options set from a static variable + // in coder_set_compression_settings(). Since this is only run in + // debug mode and will be freed when the process ends anyway, we + // don't worry about freeing it. + for (uint32_t i = 1; i < ARRAY_SIZE(filters); i++) { + if (filters_init_mask & (1 << i)) + lzma_filters_free(filters[i], NULL); + } + lzma_end(&strm); return; } |