diff options
| author | Linus Nordberg <linus@nordu.net> | 2016-10-18 13:22:25 +0200 | 
|---|---|---|
| committer | Linus Nordberg <linus@nordu.net> | 2016-10-18 13:23:06 +0200 | 
| commit | 28037df78160dc05fd56151b7c837eb4709d83c1 (patch) | |
| tree | 833ca42059b02bf0b0103b6d1307759ebbb8aea2 | |
| parent | 6a45e6949917c62aeae74c65cadcaf82df9e135f (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.c | 2 | 
1 files changed, 1 insertions, 1 deletions
| @@ -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; | 
