]> granicus.if.org Git - graphviz/commitdiff
Pango plugin gv_get_ps_fontlist: fix unchecked allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 31 Jul 2022 16:17:16 +0000 (09:17 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Aug 2022 01:01:38 +0000 (18:01 -0700)
plugin/pango/gvgetfontlist_pango.c

index d91d60d163902b91b5ee7302af3df0ee4dfe982b..c04d1476e818609c33de1b527c4aebd905b0c4d0 100644 (file)
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <cgraph/alloc.h>
 #include <cgraph/strcasecmp.h>
 
 /* FIXME - the following declaration should be removed
@@ -338,7 +339,7 @@ static availfont_t *gv_get_ps_fontlist(PangoFontMap * fontmap)
     pango_font_map_list_families(fontmap, &families, &n_families);
 
     /* Setup a pointer to available font structs */
-    gv_af_p = N_NEW(GV_FONT_LIST_SIZE, availfont_t);
+    gv_af_p = gv_calloc(GV_FONT_LIST_SIZE, sizeof(availfont_t));
 
     for (size_t j = 0; j < GV_FONT_LIST_SIZE; j++) {
        /* get the Graphviz PS font information and create the