From 28037df78160dc05fd56151b7c837eb4709d83c1 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 18 Oct 2016 13:22:25 +0200 Subject: 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. --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.1