From: Matthew Fernandez <matthew.fernandez@gmail.com> Date: Sat, 17 Sep 2022 00:32:36 +0000 (-0700) Subject: glcomp glNewFont: fix unchecked allocation failures X-Git-Tag: 6.0.2~33^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92c0962bccc9f664fc4292f8ea73ff183c892439;p=graphviz glcomp glNewFont: fix unchecked allocation failures --- diff --git a/lib/glcomp/glcompfont.c b/lib/glcomp/glcompfont.c index 7702c34d9..e023aff1a 100644 --- a/lib/glcomp/glcompfont.c +++ b/lib/glcomp/glcompfont.c @@ -8,6 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#include <cgraph/alloc.h> #include <glcomp/glcompfont.h> #include <glcomp/glcompset.h> #include <glcomp/glpangofont.h> @@ -47,7 +48,7 @@ void glDeleteFont(glCompFont * f) glCompFont *glNewFont (glCompSet * s, char *text, glCompColor * c,glCompFontType type, char *fontdesc, int fs,int is2D) { - glCompFont *font = malloc(sizeof(glCompFont)); + glCompFont *font = gv_alloc(sizeof(glCompFont)); font->reference = 0; font->color.R = c->R; font->color.G = c->G; @@ -63,7 +64,7 @@ glCompFont *glNewFont (glCompSet * s, char *text, glCompColor * c,glCompFontType else font->glutfont = NULL; - font->fontdesc = strdup(fontdesc); + font->fontdesc = gv_strdup(fontdesc); font->size = fs; font->transparent = 1; font->optimize = GL_FONTOPTIMIZE;