forked from nuttx/nuttx-update
net/getifaddrs: fix coverity bug
Signed-off-by: meijian <meijian@xiaomi.com>
This commit is contained in:
parent
884a6803d6
commit
4e7f323633
1 changed files with 6 additions and 1 deletions
|
@ -83,6 +83,11 @@ static FAR struct myifaddrs *getmutil_ipv6addr(int fd, struct lifreq *req,
|
|||
FAR struct sockaddr_in6 *ipv6addr;
|
||||
int index;
|
||||
|
||||
if (req == NULL || ifaddr == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* eth0:0 is the second ipaddr */
|
||||
|
||||
for (index = 0; index < CONFIG_NETDEV_MAX_IPv6_ADDR - 1; index++)
|
||||
|
@ -108,7 +113,7 @@ static FAR struct myifaddrs *getmutil_ipv6addr(int fd, struct lifreq *req,
|
|||
}
|
||||
|
||||
ifaddr->addrs.ifa_next = lib_zalloc(sizeof(*ifaddr));
|
||||
if (ifaddr == NULL)
|
||||
if (ifaddr->addrs.ifa_next == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue