From: Matthew Fernandez Date: Sun, 15 Jan 2023 04:19:04 +0000 (-0800) Subject: tclpkg buildBindings: fix remaining unchecked allocations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=534686ac75b1643db5795b7db72c5eaf3eb6e7a7;p=graphviz tclpkg buildBindings: fix remaining unchecked allocations --- diff --git a/tclpkg/tclpathplan/tclpathplan.c b/tclpkg/tclpathplan/tclpathplan.c index 6ef9aec01..993026172 100644 --- a/tclpkg/tclpathplan/tclpathplan.c +++ b/tclpkg/tclpathplan/tclpathplan.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "makecw.h" #include #include @@ -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; }