mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-06-14 12:30:46 +00:00
coverity: fix potential dereference NULL returned from malloc
Signed-off-by: Dwight Engen <dwight.engen@oracle.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
f2bbe86da4
commit
dd66e5adb3
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user