]> granicus.if.org Git - graphviz/commitdiff
tclpkg buildBindings: fix remaining unchecked allocations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 15 Jan 2023 04:19:04 +0000 (20:19 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 15 Jan 2023 21:12:50 +0000 (13:12 -0800)
tclpkg/tclpathplan/tclpathplan.c

index 6ef9aec01b30d9dd992cc7962ace82570c9efddf..993026172e29a9ac7f6135b47979668a0a32e65e 100644 (file)
@@ -32,6 +32,7 @@
 #include <inttypes.h>
 #include <assert.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/alloc.h>
 #include "makecw.h"
 #include <math.h>
 #include <pathplan/pathutil.h>
@@ -226,8 +227,7 @@ static char *buildBindings(char *s1, char *s2)
        } else {
            l = strlen(s2) - 1;
            if (l) {
-               s3 = malloc(l + 1);
-               strcpy(s3, s2 + 1);
+               s3 = gv_strdup(s2 + 1);
            } else {
                s3 = NULL;
            }
@@ -236,8 +236,7 @@ static char *buildBindings(char *s1, char *s2)
        free(s1);
        l = strlen(s2);
        if (l) {
-           s3 = malloc(l + 1);
-           strcpy(s3, s2);
+           s3 = gv_strdup(s2);
        } else {
            s3 = NULL;
        }