]> granicus.if.org Git - graphviz/commitdiff
sparse SingleLinkedList_prepend_int: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 29 Dec 2022 21:43:15 +0000 (13:43 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 16:33:58 +0000 (08:33 -0800)
lib/sparse/LinkedList.c

index 84917f613f61a5a30f791996a1c1b0e861f58447..64f98da8cd99237ae000108566f2a24a8d48c85c 100644 (file)
@@ -46,8 +46,7 @@ SingleLinkedList SingleLinkedList_prepend(SingleLinkedList l, void *data){
 }
 
 SingleLinkedList SingleLinkedList_prepend_int(SingleLinkedList l, int i){
-  int *data;
-  data = malloc(sizeof(int));
+  int *data = gv_alloc(sizeof(int));
   data[0] = i;
   return SingleLinkedList_prepend(l, (void*) data);
 }