logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: f953da60aab6fdc6c05a764001e84f68cd65fbed
parent ff7b6b177b257cb59c6788c3216c5264255f6538
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 14 Sep 2024 04:48:33 +0200

cmd/join: use calloc for arrays

Diffstat:

Mcmd/join.c2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/join.c b/cmd/join.c @@ -402,7 +402,7 @@ towcs(const char *s) size_t n; if((n = mbsrtowcs(NULL, &s, 0, NULL)) == (size_t)-1) return (NULL); - if((wcs = malloc((n + 1) * sizeof(*wcs))) == NULL) return (NULL); + if((wcs = calloc((n + 1), sizeof(*wcs))) == NULL) return (NULL); mbsrtowcs(wcs, &s, n + 1, NULL); return (wcs); }