From: Matthew Fernandez Date: Sat, 27 Aug 2022 15:42:47 +0000 (-0700) Subject: cgraph aglasterr: fix unchecked allocation failure X-Git-Tag: 6.0.1~19^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b441976c42d0980d24f6c34dce1bea85cbb77235;p=graphviz cgraph aglasterr: fix unchecked allocation failure --- diff --git a/lib/cgraph/agerror.c b/lib/cgraph/agerror.c index 543cf7c47..097c9cb4d 100644 --- a/lib/cgraph/agerror.c +++ b/lib/cgraph/agerror.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #define MAX(a,b) ((a)>(b)?(a):(b)) @@ -44,7 +45,7 @@ char *aglasterr() fflush(agerrout); long endpos = ftell(agerrout); size_t len = (size_t)(endpos - aglast); - char *buf = malloc(len + 1); + char *buf = gv_alloc(len + 1); fseek(agerrout, aglast, SEEK_SET); len = fread(buf, sizeof(char), len, agerrout); buf[len] = '\0';