From: Matthew Fernandez Date: Sat, 27 Aug 2022 22:31:59 +0000 (-0700) Subject: gvpr addCase: fix unchecked allocation failure X-Git-Tag: 6.0.1~18^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f6f0f3be1798da29ad17ff4ddc3c56131f1bbb9;p=graphviz gvpr addCase: fix unchecked allocation failure --- diff --git a/lib/gvpr/parse.c b/lib/gvpr/parse.c index 66e2e062b..37db51996 100644 --- a/lib/gvpr/parse.c +++ b/lib/gvpr/parse.c @@ -411,8 +411,6 @@ static parse_block *addBlock (parse_block * last, char *stmt, int line, static case_info *addCase(case_info * last, char *guard, int gline, char *action, int line, int *cnt) { - case_info *item; - if (!guard && !action) { error(ERROR_WARNING, "Case with neither guard nor action, line %d - ignored", kwLine); @@ -420,7 +418,7 @@ static case_info *addCase(case_info * last, char *guard, int gline, } ++(*cnt); - item = newof(0, case_info, 1, 0); + case_info *item = gv_alloc(sizeof(case_info)); item->guard = guard; item->action = action; item->next = NULL;