aboutsummaryrefslogtreecommitdiff
path: root/compat/compat.c
diff options
context:
space:
mode:
authorMosder <git@mosder.eu>2026-09-28 10:03:22 +0200
committerMosder <git@mosder.eu>2026-09-28 10:03:22 +0200
commit4fdedc4fa905a14a2fe0334249b71ff0e2459b09 (patch)
tree6ef5e364b661684fe25c5c07c3ea1d43aa2fcf44 /compat/compat.c
parente0447cd883278831f05d007829201f2ca9fa452f (diff)
fix: made strdup compat implementation return NULL instead of exit on insufficient memory
Diffstat (limited to 'compat/compat.c')
-rw-r--r--compat/compat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/compat/compat.c b/compat/compat.c
index 1112146..37432bf 100644
--- a/compat/compat.c
+++ b/compat/compat.c
@@ -1,10 +1,12 @@
#include "compat.h"
#ifdef NO_STRDUP
-#include "moslib/safe.h"
+#include <stdlib.h>
#include <string.h>
char *strdup(const char *s) {
- char *s2 = mos_safe_malloc(strlen(s) + 1);
+ char *s2 = malloc(strlen(s) + 1);
+ if (!s2)
+ return NULL;
strcpy(s2, s);
return s2;
}