Commit dd66e5ad by Dwight Engen Committed by Stéphane Graber

coverity: fix potential dereference NULL returned from malloc

parent f2bbe86d
...@@ -783,8 +783,11 @@ static int ifa_get_local_ip(int family, struct ip_req *ip_info, void** res) { ...@@ -783,8 +783,11 @@ static int ifa_get_local_ip(int family, struct ip_req *ip_info, void** res) {
/* We might have found an IFA_ADDRESS before, /* We might have found an IFA_ADDRESS before,
* which we now overwrite with an IFA_LOCAL. */ * which we now overwrite with an IFA_LOCAL. */
if (!*res) if (!*res) {
*res = malloc(addrlen); *res = malloc(addrlen);
if (!*res)
return -1;
}
memcpy(*res, RTA_DATA(rta), addrlen); memcpy(*res, RTA_DATA(rta), addrlen);
......
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