1 |
From bd432015d33dcade611d297bc01eb0700088ef6c Mon Sep 17 00:00:00 2001 |
2 |
From: Lasse Collin <lasse.collin@tukaani.org> |
3 |
Date: Sat, 2 Apr 2011 14:49:56 +0300 |
4 |
Subject: [PATCH] liblzma: Fix a memory leak in stream_encoder.c. |
5 |
|
6 |
It leaks old filter options structures (hundred bytes or so) |
7 |
every time the lzma_stream is reinitialized. With the xz tool, |
8 |
this happens when compressing multiple files. |
9 |
--- |
10 |
src/liblzma/common/stream_encoder.c | 2 +- |
11 |
1 files changed, 1 insertions(+), 1 deletions(-) |
12 |
|
13 |
diff --git a/src/liblzma/common/stream_encoder.c b/src/liblzma/common/stream_encoder.c |
14 |
index 48d91da..97a7a23 100644 |
15 |
--- a/src/liblzma/common/stream_encoder.c |
16 |
+++ b/src/liblzma/common/stream_encoder.c |
17 |
@@ -280,6 +280,7 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, |
18 |
next->end = &stream_encoder_end; |
19 |
next->update = &stream_encoder_update; |
20 |
|
21 |
+ next->coder->filters[0].id = LZMA_VLI_UNKNOWN; |
22 |
next->coder->block_encoder = LZMA_NEXT_CODER_INIT; |
23 |
next->coder->index_encoder = LZMA_NEXT_CODER_INIT; |
24 |
next->coder->index = NULL; |
25 |
@@ -289,7 +290,6 @@ lzma_stream_encoder_init(lzma_next_coder *next, lzma_allocator *allocator, |
26 |
next->coder->sequence = SEQ_STREAM_HEADER; |
27 |
next->coder->block_options.version = 0; |
28 |
next->coder->block_options.check = check; |
29 |
- next->coder->filters[0].id = LZMA_VLI_UNKNOWN; |
30 |
|
31 |
// Initialize the Index |
32 |
lzma_index_end(next->coder->index, allocator); |
33 |
-- |
34 |
1.7.4.2 |
35 |
|