]> granicus.if.org Git - graphviz/commitdiff
common genEllipticPath: fix unchecked allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 31 Jul 2022 16:16:12 +0000 (09:16 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Aug 2022 01:01:38 +0000 (18:01 -0700)
lib/common/ellipse.c

index ac87d9b21dcf1846063dd71c02ed0f847f7b24ff..c340831b4f170b29787f9a1b6db3c9fa05535336 100644 (file)
@@ -57,8 +57,6 @@
 #define MAX(a,b)        ((a)>(b)?(a):(b))
 #define MIN(a,b)        ((a)<(b)?(a):(b))
 
-#define NEW(t) calloc(1,sizeof(t))
-
 #define PI            3.14159265358979323846
 
 typedef struct {
@@ -460,7 +458,7 @@ static Ppolyline_t *genEllipticPath(ellipse_t * ep) {
     double yBDot;
     double t;
     double alpha;
-    Ppolyline_t *polypath = NEW(Ppolyline_t);
+    Ppolyline_t *polypath = gv_alloc(sizeof(Ppolyline_t));
 
     static const double THRESHOLD = 0.00001; // quality of approximation
     static const int DEGREE = 3;