Commit 1caa9c33 authored by Linus Nordberg's avatar Linus Nordberg

Don't use r if malloc fails.

coverity: 1450949
parent 809c10ee
......@@ -34,8 +34,10 @@ char *stringcopy(const char *s, int len) {
r = malloc(len + 1);
if (!r)
debug(DBG_ERR, "stringcopy: malloc failed");
memcpy(r, s, len);
r[len] = '\0';
else {
memcpy(r, s, len);
r[len] = '\0';
}
return r;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment