From 2235790aad6ac9fb540ee92af1201a7528788fb3 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 1 Sep 2022 18:30:01 -0700 Subject: [PATCH] smyrna attr_list_add: fix unchecked allocation failure --- cmd/smyrna/gui/frmobjectui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.40.0