From: Matthew Fernandez Date: Tue, 8 Nov 2022 02:33:30 +0000 (-0800) Subject: GD plugin: fix unchecked allocation failures X-Git-Tag: 7.0.2~14^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a7314a71778414016516131e7ec825839b1128f;p=graphviz GD plugin: fix unchecked allocation failures --- diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c index fc2d1394d..ae7979e6c 100644 --- a/plugin/gd/gvrender_gd.c +++ b/plugin/gd/gvrender_gd.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -243,7 +244,7 @@ static void gdgen_missingfont(char *fontreq) { p = DEFAULT_FONTPATH; #endif free(lastmissing); - lastmissing = strdup(fontreq); + lastmissing = gv_strdup(fontreq); n_errors++; } } @@ -488,7 +489,7 @@ static void gdgen_polygon(GVJ_t * job, pointf * A, int n, int filled) if (pen_ok || fill_ok) { if (n > 0 && (size_t)n > points_allocated) { - points = realloc(points, (size_t)n * sizeof(gdPoint)); + points = gv_recalloc(points, points_allocated, (size_t)n, sizeof(gdPoint)); points_allocated = (size_t)n; } for (i = 0; i < n; i++) {