[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (5e0bb671c487f2ba723e2965b476d6fea437e700)



The branch, master has been updated
       via  5e0bb671c487f2ba723e2965b476d6fea437e700 (commit)
      from  7dc2d854f3e58680577b2bb71cd68b2b769e3025 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid/common/draw_helpers.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)


=================
 Commit Messages
=================

commit 5e0bb671c487f2ba723e2965b476d6fea437e700
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common: Fix memory leak in polygon NoHoles clipping routine
    
    poly_CopyContour creates the edge tree, as does ContourToPoly(),
    which overwrite the one created in poly_CopyContour().
    
    Replace call to ContourToPoly() with a discrete alternative without
    the poly_PreContour() call.
    
    Also, don't try to poly_Free() the output of poly_Boolean_free() in
    an error condition. poly_Boolean_free() re-uses the A input polygon
    for its output, so attempting to free that might be dangerous.
    
    poly_Boolean_free() should free its inputs (and any partial output)
    if it encounters an error.

:100644 100644 81fb850... 5020745... M	src/hid/common/draw_helpers.c

=========
 Changes
=========

commit 5e0bb671c487f2ba723e2965b476d6fea437e700
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/common: Fix memory leak in polygon NoHoles clipping routine
    
    poly_CopyContour creates the edge tree, as does ContourToPoly(),
    which overwrite the one created in poly_CopyContour().
    
    Replace call to ContourToPoly() with a discrete alternative without
    the poly_PreContour() call.
    
    Also, don't try to poly_Free() the output of poly_Boolean_free() in
    an error condition. poly_Boolean_free() re-uses the A input polygon
    for its output, so attempting to free that might be dangerous.
    
    poly_Boolean_free() should free its inputs (and any partial output)
    if it encounters an error.

diff --git a/src/hid/common/draw_helpers.c b/src/hid/common/draw_helpers.c
index 81fb850..5020745 100644
--- a/src/hid/common/draw_helpers.c
+++ b/src/hid/common/draw_helpers.c
@@ -76,16 +76,11 @@ fill_clipped_contour (hidGC gc, PLINE *pl, const BoxType *clip_box)
   clip_poly = RectPoly (clip_box->X1, clip_box->X2,
                         clip_box->Y1, clip_box->Y2);
   poly_CopyContour (&pl_copy, pl);
-  piece_poly = ContourToPoly (pl_copy);
+  piece_poly = poly_Create ();
+  poly_InclContour (piece_poly, pl_copy);
   x = poly_Boolean_free (piece_poly, clip_poly,
                          &clipped_pieces, PBO_ISECT);
-  if (x != err_ok)
-    {
-      poly_Free (&clipped_pieces);
-      return;
-    }
-
-  if (clipped_pieces == NULL)
+  if (x != err_ok || clipped_pieces == NULL)
     return;
 
   draw_piece = clipped_pieces;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs