From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:30:01 +0000 (-0700) Subject: smyrna attr_list_add: fix unchecked allocation failure X-Git-Tag: 6.0.1~13^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2235790aad6ac9fb540ee92af1201a7528788fb3;p=graphviz smyrna attr_list_add: fix unchecked allocation failure --- diff --git a/cmd/smyrna/gui/frmobjectui.c b/cmd/smyrna/gui/frmobjectui.c index c90126402..3299b52bb 100644 --- a/cmd/smyrna/gui/frmobjectui.c +++ b/cmd/smyrna/gui/frmobjectui.c @@ -17,7 +17,6 @@ #include #include #include "viewport.h" -#include #include "frmobjectui.h" #include #include @@ -189,9 +188,10 @@ static void attr_list_add(attr_list *l, attr_t *a) { return; l->attr_count++; if (l->attr_count == l->capacity) { + l->attributes = gv_recalloc(l->attributes, l->capacity, + l->capacity + EXPAND_CAPACITY_VALUE, + sizeof(attr_t *)); l->capacity = l->capacity + EXPAND_CAPACITY_VALUE; - l->attributes = - realloc(l->attributes, l->capacity * sizeof(attr_t *)); } l->attributes[l->attr_count - 1] = a; if (l->attr_count > 1)