From 22f110db281176b477ec8508b077750ab3449f97 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Fri, 22 Sep 2023 11:24:37 +0200 Subject: [PATCH] libutil: Remove free() from strnsub() The free() was added in the wrong assumption that xargs was not freeing the argument in the position replaced, but it actually does it. Also, removing the call to free() makes more general the function. --- libutil/strnsubst.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libutil/strnsubst.c b/libutil/strnsubst.c index 9ea6013..2da54ab 100644 --- a/libutil/strnsubst.c +++ b/libutil/strnsubst.c @@ -56,7 +56,6 @@ strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) } strlcpy(s2 + s2len, s1, maxsize - s2len); done: - free(*str); *str = s2; return; }