From 3f6f0f3be1798da29ad17ff4ddc3c56131f1bbb9 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 27 Aug 2022 15:31:59 -0700 Subject: [PATCH] gvpr addCase: fix unchecked allocation failure --- lib/gvpr/parse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; -- 2.40.0