[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1752-g9001678

[email protected] (Julian Smith) Fri, 25 Oct 2019 11:26:30 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  9001678252cc6c4e45251db70b83daae39b7d4ec (commit)
      from  d6746f08c592057dfd3abe1b957c8b23971508cc (commit)

----------------------------------------------------------------------
commit 9001678252cc6c4e45251db70b83daae39b7d4ec
Author: Julian Smith <[email protected]>
Date:   Thu Oct 24 15:04:58 2019 +0100

    Bug 697545 (Memory Squeezing): fixed hpgl_polyfill_using_current_line_type() leak on error.
    
    Need to always call hpgl_grestore().
    
    Fixes this leak:
        MEMENTO_FAILAT=15840 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ../pcl5cfts/fts.1552

diff --git a/pcl/pcl/pgdraw.c b/pcl/pcl/pgdraw.c
index 17f12a0..0a4baf3 100644
--- a/pcl/pcl/pgdraw.c
+++ b/pcl/pcl/pgdraw.c
@@ -858,6 +858,8 @@ static int
 hpgl_polyfill_using_current_line_type(hpgl_state_t * pgls,
                                       hpgl_rendering_mode_t render_mode)
 {
+    int code;
+
     /* gsave and grestore used to preserve the clipping region */
     hpgl_call(hpgl_gsave(pgls));
 
@@ -866,13 +868,17 @@ hpgl_polyfill_using_current_line_type(hpgl_state_t * pgls,
      * beginning at the anchor corner replicate lines
      */
     if (pgls->g.fill_type == hpgl_even_odd_rule)
-        hpgl_call(gs_eoclip(pgls->pgs));
+        code = gs_eoclip(pgls->pgs);
     else
-        hpgl_call(gs_clip(pgls->pgs));
-    hpgl_call(hpgl_fill_polyfill_background(pgls));
-    hpgl_call(hpgl_polyfill(pgls, render_mode));
-    hpgl_call(hpgl_grestore(pgls));
-    return 0;
+        code = gs_clip(pgls->pgs);
+    if (code >= 0)  code = hpgl_fill_polyfill_background(pgls);
+    if (code >= 0)  code = hpgl_polyfill(pgls, render_mode);
+
+    {
+        int code2 = hpgl_grestore(pgls);
+        if (code >= 0)  code = code2;
+        return code;
+    }
 }
 
 static gs_rop3_t


Summary of changes:
 pcl/pcl/pgdraw.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)