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

index ceb983bc33d4e77921face4aec508700220b3aa8..ac87d9b21dcf1846063dd71c02ed0f847f7b24ff 100644 (file)
@@ -46,6 +46,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <cgraph/alloc.h>
 #include <stdbool.h>
 #ifdef STANDALONE
 #include <limits.h>
@@ -57,7 +58,6 @@
 #define MIN(a,b)        ((a)<(b)?(a):(b))
 
 #define NEW(t) calloc(1,sizeof(t))
-#define N_NEW(n,t) calloc(n,sizeof(t))
 
 #define PI            3.14159265358979323846
 
@@ -403,7 +403,7 @@ static int bufsize;
 static void moveTo(Ppolyline_t *polypath, double x, double y)
 {
     bufsize = 100;
-    polypath->ps = N_NEW(bufsize, pointf);
+    polypath->ps = gv_calloc(bufsize, sizeof(pointf));
     polypath->ps[0].x = x;
     polypath->ps[0].y = y;
     polypath->pn = 1;