$NetBSD: patch-CVE-2017-6196,v 1.1 2017/03/23 20:38:24 tez Exp $

Patch for CVE-2017-6196 adapted from:

http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=ecceafe3abba2714ef9b432035fe0739d9b1a283


--- base/gxipixel.c
+++ base/gxipixel.c
@@ -257,7 +257,6 @@ gx_image_enum_begin(gx_device * dev, con
         if ((code = gs_matrix_invert_to_double(&pim->ImageMatrix, &mat)) < 0 ||
             (code = gs_matrix_multiply_double(&mat, pmat, &mat)) < 0
             ) {
-            gs_free_object(mem, penum, "gx_default_begin_image");
             return code;
         }
     }
@@ -487,7 +486,6 @@ gx_image_enum_begin(gx_device * dev, con
     }
     if (masked) {       /* This is imagemask. */
         if (bps != 1 || pcs != NULL || penum->alpha || decode[0] == decode[1]) {
-            gs_free_object(mem, penum, "gx_default_begin_image");
             return_error(gs_error_rangecheck);
         }
         /* Initialize color entries 0 and 255. */
@@ -507,7 +505,6 @@ gx_image_enum_begin(gx_device * dev, con
 
         spp = cs_num_components(pcs);
         if (spp < 0) {          /* Pattern not allowed */
-            gs_free_object(mem, penum, "gx_default_begin_image");
             return_error(gs_error_rangecheck);
         }
         if (penum->alpha)
@@ -613,7 +610,6 @@ gx_image_enum_begin(gx_device * dev, con
     bsize = ((bps > 8 ? width * 2 : width) + 15) * spp;
     buffer = gs_alloc_bytes(mem, bsize, "image buffer");
     if (buffer == 0) {
-        gs_free_object(mem, penum, "gx_default_begin_image");
         return_error(gs_error_VMerror);
     }
     penum->bps = bps;
