From 223f22d1c0276afce09f6065aed58f1b6775f7ee Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 14 Jan 2023 20:15:30 -0800 Subject: [PATCH] tclpkg buildBindings: swap unchecked allocation for agxbuf Apart from fixing an unchecked allocation, this is shorter with fewer things to worry about. --- tclpkg/tclpathplan/tclpathplan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tclpkg/tclpathplan/tclpathplan.c b/tclpkg/tclpathplan/tclpathplan.c index d9d737e18..6ef9aec01 100644 --- a/tclpkg/tclpathplan/tclpathplan.c +++ b/tclpkg/tclpathplan/tclpathplan.c @@ -31,6 +31,7 @@ #include #include +#include #include "makecw.h" #include #include @@ -215,11 +216,10 @@ static char *buildBindings(char *s1, char *s2) if (s1) { l = strlen(s2) - 1; if (l) { - s3 = malloc(strlen(s1) + l + 2); - strcpy(s3, s1); - strcat(s3, "\n"); - strcat(s3, s2 + 1); + agxbuf new = {0}; + agxbprint(&new, "%s\n%s", s1, s2 + 1); free(s1); + return agxbdisown(&new); } else { s3 = s1; } -- 2.40.0