diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-11-26 22:21:13 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-11-26 22:21:13 +0200 |
commit | e782af9110d8499c7ac2929bc871540eefea5ea1 (patch) | |
tree | 73fe67b4bb9bbb94ecbb1738f97bc171fd9d2d17 /src/liblzma/common/block_header_decoder.c | |
parent | liblzma: Omit simple coder init functions if they are disabled. (diff) | |
download | xz-e782af9110d8499c7ac2929bc871540eefea5ea1.tar.xz |
liblzma: Use lzma_filters_free() in more places.
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/common/block_header_decoder.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/liblzma/common/block_header_decoder.c b/src/liblzma/common/block_header_decoder.c index 24588c56..9b9408b0 100644 --- a/src/liblzma/common/block_header_decoder.c +++ b/src/liblzma/common/block_header_decoder.c @@ -14,22 +14,6 @@ #include "check.h" -static void -free_properties(lzma_block *block, const lzma_allocator *allocator) -{ - // Free allocated filter options. The last array member is not - // touched after the initialization in the beginning of - // lzma_block_header_decode(), so we don't need to touch that here. - for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) { - lzma_free(block->filters[i].options, allocator); - block->filters[i].id = LZMA_VLI_UNKNOWN; - block->filters[i].options = NULL; - } - - return; -} - - extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, const lzma_allocator *allocator, const uint8_t *in) @@ -107,7 +91,7 @@ lzma_block_header_decode(lzma_block *block, &block->filters[i], allocator, in, &in_pos, in_size); if (ret != LZMA_OK) { - free_properties(block, allocator); + lzma_filters_free(block->filters, allocator); return ret; } } @@ -115,7 +99,7 @@ lzma_block_header_decode(lzma_block *block, // Padding while (in_pos < in_size) { if (in[in_pos++] != 0x00) { - free_properties(block, allocator); + lzma_filters_free(block->filters, allocator); // Possibly some new field present so use // LZMA_OPTIONS_ERROR instead of LZMA_DATA_ERROR. |