]> granicus.if.org Git - graphviz/commitdiff
smyrna combineCallback: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 00:58:17 +0000 (17:58 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 00:59:51 +0000 (17:59 -0700)
cmd/smyrna/polytess.c

index ec979681815b9985f2e3d27058811a1771b13cde..de84563d476fc2925bf8a8b8346f34c1e34fbf98 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #include "polytess.h"
+#include <cgraph/alloc.h>
 #include <stddef.h>
 #include <xdot/xdot.h>
 tessPoly TP;
@@ -21,9 +22,8 @@ static void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4
     (void)vertex_data;
     (void)weight;
 
-    GLdouble *vertex;
     int i;
-    vertex = malloc(6 * sizeof(GLdouble));
+    GLdouble *vertex = gv_calloc(6, sizeof(GLdouble));
     vertex[0] = coords[0];
     vertex[1] = coords[1];
     vertex[2] = coords[2];