From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:02:37 +0000 (-0700) Subject: smyrna add_selpoly: fix unchecked allocation failure X-Git-Tag: 6.0.1~13^2~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca6bdd254c6334c250c6e05f38d3a02540d21e19;p=graphviz smyrna add_selpoly: fix unchecked allocation failure --- diff --git a/cmd/smyrna/selectionfuncs.c b/cmd/smyrna/selectionfuncs.c index 184b44d01..04d9e23c0 100644 --- a/cmd/smyrna/selectionfuncs.c +++ b/cmd/smyrna/selectionfuncs.c @@ -8,6 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ +#include #include #include "selectionfuncs.h" #include "topviewfuncs.h" @@ -272,8 +273,9 @@ void add_selpoly(Agraph_t* g,glCompPoly* selPoly,glCompPoint pt) { if(!close_poly(selPoly,pt)) { + selPoly->pts = gv_recalloc(selPoly->pts, selPoly->cnt, selPoly->cnt + 1, + sizeof(glCompPoint)); selPoly->cnt ++; - selPoly->pts=realloc(selPoly->pts,sizeof(glCompPoint)*selPoly->cnt); selPoly->pts[selPoly->cnt-1].x=pt.x; selPoly->pts[selPoly->cnt-1].y=pt.y; selPoly->pts[selPoly->cnt-1].z=0;