libutil: Remove free() from strnsub() - sbase - suckless unix tools | |
git clone git://git.suckless.org/sbase | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 22f110db281176b477ec8508b077750ab3449f97 | |
parent 4e8a096b1cffe97f96cee964e0273b2163130c4b | |
Author: Roberto E. Vargas Caballero <[email protected]> | |
Date: Fri, 22 Sep 2023 11:24:37 +0200 | |
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. | |
Diffstat: | |
M libutil/strnsubst.c | 1 - | |
1 file changed, 0 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/libutil/strnsubst.c b/libutil/strnsubst.c | |
@@ -56,7 +56,6 @@ strnsubst(char **str, const char *match, const char *replstr,… | |
} | |
strlcpy(s2 + s2len, s1, maxsize - s2len); | |
done: | |
- free(*str); | |
*str = s2; | |
return; | |
} |