[jbig2-cvs] rev 385 - trunk

giles at ghostscript.com giles at ghostscript.com
Mon Jan 3 21:07:45 PST 2005


Author: giles
Date: 2005-01-03 21:07:45 -0800 (Mon, 03 Jan 2005)
New Revision: 385

Modified:
   trunk/jbig2_symbol_dict.c
Log:
Properly free the arith and word stream states in symbol dictionary decoding.


Modified: trunk/jbig2_symbol_dict.c
===================================================================
--- trunk/jbig2_symbol_dict.c	2005-01-04 04:53:16 UTC (rev 384)
+++ trunk/jbig2_symbol_dict.c	2005-01-04 05:07:45 UTC (rev 385)
@@ -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);
@@ -485,6 +486,11 @@
   
   jbig2_sd_release(ctx, SDNEWSYMS);
   
+  if (!params->SDHUFF) {
+    jbig2_free(ctx->allocator, as);  
+    jbig2_word_stream_buf_free(ctx, ws);
+  }
+  
   return SDEXSYMS;
 }
 



More information about the jbig2-cvs mailing list