]> granicus.if.org Git - graphviz/commitdiff
Pango plugin get_font_mapping: fix unchecked allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 31 Jul 2022 16:17:49 +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 c04d1476e818609c33de1b527c4aebd905b0c4d0..251db4cd947dff013605ca7e46aea4c5e93f5469 100644 (file)
@@ -243,7 +243,6 @@ typedef struct {
 } availfont_t;
 
 #define NEW(t)          malloc(sizeof(t))
-#define N_NEW(n,t)      calloc((n),sizeof(t))
 
 static PostscriptAlias postscript_alias[] = {
 #include "ps_font_equiv.h"
@@ -498,7 +497,7 @@ gv_font_map* get_font_mapping(PangoFontMap * fontmap)
     availfont_t *gv_af_p;
     static const size_t ps_fontnames_sz =
       sizeof(postscript_alias) / sizeof(PostscriptAlias);
-    gv_font_map* gv_fmap = N_NEW(ps_fontnames_sz, gv_font_map);
+    gv_font_map* gv_fmap = gv_calloc(ps_fontnames_sz, sizeof(gv_font_map));
     agxbuf xb;
     agxbuf xb2;
     char buf[BUFSIZ];