summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-10-18 13:22:25 +0200
committerLinus Nordberg <linus@nordu.net>2016-10-18 13:23:06 +0200
commit28037df78160dc05fd56151b7c837eb4709d83c1 (patch)
tree833ca42059b02bf0b0103b6d1307759ebbb8aea2
parent6a45e6949917c62aeae74c65cadcaf82df9e135f (diff)
Exit if stringcopy() fails at allocating memory.
Writing to 0 seems unwise to me. Returning NULL will simply move the problem to the callers. I admit that a better fix would be to fix all the callers.
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 55bf3c7..98d6680 100644
--- a/util.c
+++ b/util.c
@@ -23,7 +23,7 @@ char *stringcopy(const char *s, int len) {
len = strlen(s);
r = malloc(len + 1);
if (!r)
- debug(DBG_ERR, "stringcopy: malloc failed");
+ debugx(1, DBG_ERR, "stringcopy: malloc failed");
memcpy(r, s, len);
r[len] = '\0';
return r;