aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-06-04 13:17:58 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-06-04 13:17:58 -0400
commit2b5c0a0a6a0881f0a00d785c3da1dd2a635e3557 (patch)
tree331c01687d23797b2783752eb27dfc72f7e6de91 /src
parent4a7a44eccbb7c2096f3bfc00c27c7ccadc028aba (diff)
downloadstasis-2b5c0a0a6a0881f0a00d785c3da1dd2a635e3557.tar.gz
join: Fix segfault on memory error
Diffstat (limited to 'src')
-rw-r--r--src/lib/core/str.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/core/str.c b/src/lib/core/str.c
index 400c93c..84a325b 100644
--- a/src/lib/core/str.c
+++ b/src/lib/core/str.c
@@ -171,6 +171,10 @@ char *join(char **arr, const char *separator) {
total_bytes += (records * strlen(separator)) + 1;
result = (char *)calloc(total_bytes, sizeof(char));
+ if (!result) {
+ return NULL;
+ }
+
for (int i = 0; i < records; i++) {
safe_strncat(result, arr[i], total_bytes);
if (i < (records - 1)) {