From 20ed9fb7681ca8c1da0637fec87247da94682b4c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 28 Aug 2022 08:52:50 -0700 Subject: [PATCH] gml2gv mkAttr: fix unchecked allocation failures --- cmd/tools/gmlparse.y | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/tools/gmlparse.y b/cmd/tools/gmlparse.y index 9c438b936..7bde88803 100644 --- a/cmd/tools/gmlparse.y +++ b/cmd/tools/gmlparse.y @@ -27,8 +27,6 @@ #include #include -#define NEW(t) malloc(sizeof(t)) - static gmlgraph* G; static gmlnode* N; static gmledge* E; @@ -201,11 +199,11 @@ mkEdge (void) static gmlattr *mkAttr(char* name, unsigned short sort, unsigned short kind, char* str, Dt_t* list) { - gmlattr* gp = NEW(gmlattr); + gmlattr* gp = gv_alloc(sizeof(gmlattr)); assert (name || sort); if (!name) - name = strdup (sortToStr (sort)); + name = gv_strdup (sortToStr (sort)); gp->sort = sort; gp->kind = kind; gp->name = name; -- 2.40.0