[gs-cvs] rev 8692 - branches/mtrender/src
ray at ghostscript.com
ray at ghostscript.com
Thu May 1 22:45:22 PDT 2008
Author: ray
Date: 2008-05-01 22:45:21 -0700 (Thu, 01 May 2008)
New Revision: 8692
Modified:
branches/mtrender/src/gdevp14.c
branches/mtrender/src/gxdhtserial.c
Log:
Eliminate leaks detected during rendering bands. The pdf14 device was leaking
'maskbuf' elements and the 'ht' logic was leaking 'levels' and 'bit_data'
elements, per component, of the 'order'. Other leaks detected will be opened
as bugs.
Modified: branches/mtrender/src/gdevp14.c
===================================================================
--- branches/mtrender/src/gdevp14.c 2008-05-02 05:39:35 UTC (rev 8691)
+++ branches/mtrender/src/gdevp14.c 2008-05-02 05:45:21 UTC (rev 8692)
@@ -1014,6 +1014,11 @@
if_debug1('v', "[v]pdf14_pop_transparency_mask, idle=%d\n", tos->idle);
ctx->stack = tos->saved;
+ if (tos->maskbuf) {
+ /* The maskbuf of the ctx->maskbuf entry is never used, free it now */
+ pdf14_buf_free(tos->maskbuf, ctx->memory);
+ tos->maskbuf = NULL;
+ }
ctx->maskbuf = tos;
return 0;
}
Modified: branches/mtrender/src/gxdhtserial.c
===================================================================
--- branches/mtrender/src/gxdhtserial.c 2008-05-02 05:39:35 UTC (rev 8691)
+++ branches/mtrender/src/gxdhtserial.c 2008-05-02 05:45:21 UTC (rev 8692)
@@ -622,6 +622,7 @@
gs_memory_t * mem )
{
gx_ht_order_component components[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ gx_ht_order_component components_save[GX_DEVICE_COLOR_MAX_COMPONENTS];
const byte * data0 = data;
gx_device_halftone dht;
int num_dev_comps;
@@ -656,8 +657,14 @@
}
/* if everything is OK, install the halftone */
- if (code >= 0)
+ if (code >= 0) {
+ /* save since the 'install' copies the order, but then clears the source order */
+ for (i = 0; i < num_dev_comps; i++)
+ components_save[i] = components[i];
code = gx_imager_dev_ht_install(pis, &dht, dht.type, dev);
+ for (i = 0; i < num_dev_comps; i++)
+ gx_ht_order_release(&components_save[i].corder, mem, false);
+ }
/*
* If installation failed, discard the allocated elements. We can't
More information about the gs-cvs
mailing list