]> granicus.if.org Git - graphviz/commitdiff
smyrna attr_list_new: fix unchecked allocation failures
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:29:37 +0000 (18:29 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:29:37 +0000 (18:29 -0700)
cmd/smyrna/gui/frmobjectui.c

index bfbacc94770c47fcb9c1f94c5e7b593c60dad3ff..c90126402536711aa0161a0872890e625f5f8696 100644 (file)
@@ -144,10 +144,10 @@ static void free_attr_list(attr_list *l) {
 // that uses quicksort
 static attr_list *attr_list_new(Agraph_t *g, int with_widgets) {
     int id;
-    attr_list *l = malloc(sizeof(attr_list));
+    attr_list *l = gv_alloc(sizeof(attr_list));
     l->attr_count = 0;
     l->capacity = DEFAULT_ATTR_LIST_CAPACITY;
-    l->attributes = malloc(DEFAULT_ATTR_LIST_CAPACITY * sizeof(attr_t *));
+    l->attributes = gv_calloc(DEFAULT_ATTR_LIST_CAPACITY, sizeof(attr_t*));
     l->with_widgets = with_widgets;
     /*create filter widgets */