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

index 2d1a6b45fc33b0e3df83dfb4cd5c60602c396586..6827263c3c9aef620facaebdf14ccde8676dcee3 100644 (file)
@@ -19,8 +19,7 @@ SingleLinkedList SingleLinkedList_new(void *data){
 }
 
 SingleLinkedList SingleLinkedList_new_int(int i){
-  int *data;
-  data = malloc(sizeof(int));
+  int *data = gv_alloc(sizeof(int));
   data[0] = i;
   return SingleLinkedList_new((void*) data);
 }