ref: bff29a59cb009b2cb0b397c137e8576e9f3acb0b
parent: 81b746740b074f5a0a8b539bc4954dad5c5797be
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Tue Jan 4 00:07:45 EST 2005
Properly free the arith and word stream states in symbol dictionary decoding. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@385 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -216,6 +216,7 @@
uint32_t NSYMSDECODED;
int32_t SYMWIDTH, TOTWIDTH;
uint32_t HCFIRSTSYM;
+ Jbig2WordStream *ws = NULL;
Jbig2ArithState *as = NULL;
Jbig2ArithIntCtx *IADH = NULL;
Jbig2ArithIntCtx *IADW = NULL;
@@ -231,7 +232,7 @@
NSYMSDECODED = 0;
if (!params->SDHUFF) {
- Jbig2WordStream *ws = jbig2_word_stream_buf_new(ctx, data, size);
+ ws = jbig2_word_stream_buf_new(ctx, data, size);
as = jbig2_arith_new(ctx, ws);
IADH = jbig2_arith_int_ctx_new(ctx);
IADW = jbig2_arith_int_ctx_new(ctx);
@@ -484,6 +485,11 @@
}
jbig2_sd_release(ctx, SDNEWSYMS);
+
+ if (!params->SDHUFF) {
+ jbig2_free(ctx->allocator, as);
+ jbig2_word_stream_buf_free(ctx, ws);
+ }
return SDEXSYMS;
}