]> granicus.if.org Git - graphviz/commitdiff
GD plugin vrml_polygon: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 4 Sep 2022 19:36:28 +0000 (12:36 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 5 Sep 2022 22:27:17 +0000 (15:27 -0700)
plugin/gd/gvrender_gd_vrml.c

index a9f76a12d9b91d51220a6156a2f907db7dce4f46..16272b07e4564eb59a21e8a7654e5c83a808df9e 100644 (file)
 
 #ifdef HAVE_GD_PNG
 
-/* for N_GNEW() */
-#include <common/memory.h>
-
 /* for gvcolor_t */
 #include <common/color.h>
 
 #include <cgraph/agxbuf.h>
 #include <cgraph/alloc.h>
 #include <cgraph/cgraph.h>
-#include <common/memory.h>
 #include <common/render.h>
 
 /* for wind() */
@@ -607,7 +603,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
     case NODE_OBJTYPE:
        n = obj->u.n;
        pen = set_penstyle(job, state->im, brush);
-       points = N_GGNEW(np, gdPoint);
+       points = gv_calloc(np, sizeof(gdPoint));
        for (i = 0; i < np; i++) {
            mp = vrml_node_point(job, n, A[i]);
            points[i].x = ROUND(mp.x);