From b441976c42d0980d24f6c34dce1bea85cbb77235 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 27 Aug 2022 08:42:47 -0700 Subject: [PATCH] cgraph aglasterr: fix unchecked allocation failure --- lib/cgraph/agerror.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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'; -- 2.40.0