From 0892394aa512dd8253c11932c10ffe26e8bc25ad Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 12 Feb 2025 16:40:18 -0500 Subject: Simplify string duplication in normalize_space --- src/lib/core/str.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/core/str.c b/src/lib/core/str.c index d774e72..6457afe 100644 --- a/src/lib/core/str.c +++ b/src/lib/core/str.c @@ -526,7 +526,7 @@ char *normalize_space(char *s) { return NULL; } - if ((tmp = calloc(strlen(s) + 1, sizeof(char))) == NULL) { + if (!(tmp = strdup(s))) { perror("could not allocate memory for temporary string"); return NULL; } -- cgit