1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

liblzma: Fix a memory leak in stream_encoder.c.

It leaks old filter options structures (hundred bytes or so)
every time the lzma_stream is reinitialized. With the xz tool,
this happens when compressing multiple files.
This commit is contained in:
Lasse Collin 2011-04-02 14:49:56 +03:00
parent 1688901321
commit bd432015d3

View file

@ -280,6 +280,7 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
next->end = &stream_encoder_end; next->end = &stream_encoder_end;
next->update = &stream_encoder_update; next->update = &stream_encoder_update;
next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
next->coder->block_encoder = LZMA_NEXT_CODER_INIT; next->coder->block_encoder = LZMA_NEXT_CODER_INIT;
next->coder->index_encoder = LZMA_NEXT_CODER_INIT; next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
next->coder->index = NULL; next->coder->index = NULL;
@ -289,7 +290,6 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator,
next->coder->sequence = SEQ_STREAM_HEADER; next->coder->sequence = SEQ_STREAM_HEADER;
next->coder->block_options.version = 0; next->coder->block_options.version = 0;
next->coder->block_options.check = check; next->coder->block_options.check = check;
next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
// Initialize the Index // Initialize the Index
lzma_index_end(next->coder->index, allocator); lzma_index_end(next->coder->index, allocator);