aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-25 10:16:36 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-25 10:16:36 -0400
commit237872ae44b1b3debb96e4f96d21c3c06dbdf761 (patch)
tree0210e98e4b9123eda25ecbaae7696315abaae1fd
parent7b7d84b3bea179d607fae2db5de7613adef1a6fd (diff)
downloadstasis-237872ae44b1b3debb96e4f96d21c3c06dbdf761.tar.gz
strdup_array: handle allocation errors
-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 b04dfed..a08bd2b 100644
--- a/src/lib/core/str.c
+++ b/src/lib/core/str.c
@@ -587,6 +587,10 @@ char **strdup_array(char **array) {
// Create new array
result = calloc(elems + 1, sizeof(*result));
+ if (!result) {
+ SYSERROR("%s", "could not allocate memory for result array");
+ return NULL;
+ }
for (size_t i = 0; i < elems; i++) {
result[i] = strdup(array[i]);
if (!result[i]) {