shithub: jbig2

Download patch

ref: b76f84cbe3982b71357c727c208401d6645ecad3
parent: 70a3ad1514050d5babcc18fb1bd327db1cfbfdc8
author: Ralph Giles <giles@ghostscript.com>
date: Wed Jul 15 21:52:01 EDT 2009

Clone and release the page images returned to the client.

--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -294,7 +294,7 @@
             ctx->pages[index].state = JBIG2_PAGE_RETURNED;
             jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1,
                 "page %d returned to the client", ctx->pages[index].number);
-            return ctx->pages[index].image;
+            return jbig2_image_clone(ctx, ctx->pages[index].image);
         }
     }
 
@@ -312,7 +312,7 @@
     /* find the matching page struct and mark it released */
     for (index = 0; index < ctx->max_page_index; index++) {
         if (ctx->pages[index].image == image) {
-            /* todo: free associated image */
+            jbig2_image_release(ctx, image);
             ctx->pages[index].state = JBIG2_PAGE_RELEASED;
             jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1,
                 "page %d released by the client", ctx->pages[index].number);