From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:14:05 +0000 (-0700) Subject: smyrna add_graph_to_viewport: fix unchecked allocation failure X-Git-Tag: 6.0.1~13^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ae152146fe64bf296dede6f3ff349449180d147;p=graphviz smyrna add_graph_to_viewport: fix unchecked allocation failure --- diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 3bf122955..7aed95dd4 100644 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -13,6 +13,7 @@ #endif #include "viewport.h" #include "draw.h" +#include #include #include #include "gui.h" @@ -517,9 +518,9 @@ static void activate(int id) int add_graph_to_viewport(Agraph_t * graph, char *id) { if (graph) { + view->g = gv_recalloc(view->g, view->graphCount, view->graphCount + 1, + sizeof(Agraph_t*)); view->graphCount = view->graphCount + 1; - view->g = realloc(view->g, - sizeof(Agraph_t *) * view->graphCount); view->g[view->graphCount - 1] = graph; gtk_combo_box_append_text(view->graphComboBox, id);