[jbig2-cvs] rev 380 - trunk

giles at ghostscript.com giles at ghostscript.com
Mon Jan 3 16:34:17 PST 2005


Author: giles
Date: 2005-01-03 16:34:16 -0800 (Mon, 03 Jan 2005)
New Revision: 380

Modified:
   trunk/jbig2.c
Log:
Properly free the decoded page image array on context free.


Modified: trunk/jbig2.c
===================================================================
--- trunk/jbig2.c	2005-01-04 00:32:36 UTC (rev 379)
+++ trunk/jbig2.c	2005-01-04 00:34:16 UTC (rev 380)
@@ -352,14 +352,18 @@
   int i;
 
   jbig2_free(ca, ctx->buf);
-  if (ctx->segments != NULL)
-    {
-      for (i = ctx->segment_index; i < ctx->n_segments; i++)
-	jbig2_free_segment(ctx, ctx->segments[i]);
-      jbig2_free(ca, ctx->segments);
-    }
+  if (ctx->segments != NULL) {
+    for (i = ctx->segment_index; i < ctx->n_segments; i++)
+      jbig2_free_segment(ctx, ctx->segments[i]);
+    jbig2_free(ca, ctx->segments);
+  }
 
-  /* todo: free pages */
+  if (ctx->pages != NULL) {
+    for (i = 0; i <= ctx->current_page; i++)
+      if (ctx->pages[i].image != NULL)
+	jbig2_image_release(ctx, ctx->pages[i].image);
+    jbig2_free(ca, ctx->pages);
+  }
 
   jbig2_free(ca, ctx);
 }



More information about the jbig2-cvs mailing list