]> granicus.if.org Git - graphviz/commitdiff
glcomp glCompSetAddObj: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 17 Sep 2022 00:40:00 +0000 (17:40 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 21 Sep 2022 00:17:10 +0000 (17:17 -0700)
lib/glcomp/glcompset.c

index 88ae68b59dd1e234765c2821f859f2f971495d19..af65053c75e63abfeba48a056bbd88124f8d5c3d 100644 (file)
@@ -219,8 +219,8 @@ glCompSet *glCompSetNew(int w, int h)
 
 void glCompSetAddObj(glCompSet * s, glCompObj * obj)
 {
+    s->obj = gv_recalloc(s->obj, s->objcnt, s->objcnt + 1, sizeof(glCompObj*));
     s->objcnt++;
-    s->obj = realloc(s->obj, sizeof(glCompObj *) * s->objcnt);
     s->obj[s->objcnt - 1] = obj;
     obj->common.compset = s;
 }