]> granicus.if.org Git - graphviz/commitdiff
gvpr fullColor: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Aug 2022 22:25:02 +0000 (15:25 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 30 Aug 2022 03:01:58 +0000 (20:01 -0700)
lib/gvpr/actions.c

index 6047583b099c460eabf06346d390ce0b5750a1fa..4b1878a5ec05fd83bce015ece501462585d9c2fe 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/alloc.h>
 #include <cgraph/likely.h>
 #include <cgraph/strcasecmp.h>
 #include <cgraph/unreachable.h>
@@ -968,8 +969,8 @@ static char* fullColor (char* prefix, char* str)
     size_t len = strlen (prefix) + strlen (str) + 3;
 
     if (len >= allocated) {
+       fulls = gv_realloc(fulls, allocated, len + 10);
        allocated = len + 10;
-       fulls = newof(fulls, char, allocated, 0);
     }
     sprintf (fulls, "/%s/%s", prefix, str);
     return fulls;