Summary: | memleak with jbig2 images | ||
---|---|---|---|
Product: | jbig2dec | Reporter: | Krzysztof Kowalczyk <kkowalczyk> |
Component: | Parsing | Assignee: | Henry Stiles <henry.stiles> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | master | ||
Hardware: | All | ||
OS: | All | ||
Customer: | Word Size: | --- | |
Attachments: | jbig-decode-error.pdf |
Description
Krzysztof Kowalczyk
2009-07-03 01:07:55 UTC
Created attachment 5180 [details]
jbig-decode-error.pdf
PDF that shows the memleak
The main leaks seem to have been fixed, the only one that remains is a 24 byte struct. The following patch makes sure that the word stream is freed. I haven't tested it exclusively, but it plugs the leak in the example file. diff --git a/jbig2_text.c b/jbig2_text.c index d910d81..9b13692 100644 --- a/jbig2_text.c +++ b/jbig2_text.c @@ -711,7 +711,6 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data } as = jbig2_arith_new(ctx, ws); - ws = 0; params.IADT = jbig2_arith_int_ctx_new(ctx); params.IAFS = jbig2_arith_int_ctx_new(ctx); @@ -730,7 +729,7 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data code = jbig2_decode_text_region(ctx, segment, ¶ms, (const Jbig2SymbolDict * const *)dicts, n_dicts, image, segment_data + offset, segment->data_length - offset, - GR_stats, as, ws); + GR_stats, as, as ? NULL : ws); if (!params.SBHUFF && params.SBREFINE) { jbig2_free(ctx->allocator, GR_stats); @@ -745,6 +744,7 @@ jbig2_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data jbig2_release_huffman_table(ctx, params.SBHUFFRDW); jbig2_release_huffman_table(ctx, params.SBHUFFRDH); jbig2_release_huffman_table(ctx, params.SBHUFFRSIZE); + jbig2_word_stream_buf_free(ctx, ws); } else { jbig2_arith_int_ctx_free(ctx, params.IADT); *** Bug 690607 has been marked as a duplicate of this bug. *** |