aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-22 11:23:50 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-22 11:23:50 -0400
commit38e6862a2dc5c411b542d2496f220e50205c1ec4 (patch)
treebdd0c2fc5aac6c9f00a267c6942121ded9d0fdbc /src
parent38382cba7b22e66119394667921ef62eec8d0d02 (diff)
downloadstasis-38e6862a2dc5c411b542d2496f220e50205c1ec4.tar.gz
strdup_maybe exits the program on memory error
Diffstat (limited to 'src')
-rw-r--r--src/lib/delivery/delivery.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/delivery/delivery.c b/src/lib/delivery/delivery.c
index 7d78878..eb74b6c 100644
--- a/src/lib/delivery/delivery.c
+++ b/src/lib/delivery/delivery.c
@@ -2,7 +2,12 @@
static char *strdup_maybe(const char * restrict s) {
if (s != NULL) {
- return strdup(s);
+ char *x = strdup(s);
+ if (!x) {
+ SYSERROR("%s", "strdup failed");
+ exit(1);
+ }
+ return x;
}
return NULL;
}