From: Matthew Fernandez Date: Sun, 28 Aug 2022 15:52:50 +0000 (-0700) Subject: gml2gv mkAttr: fix unchecked allocation failures X-Git-Tag: 6.0.1~17^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20ed9fb7681ca8c1da0637fec87247da94682b4c;p=graphviz gml2gv mkAttr: fix unchecked allocation failures --- 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;