net/route: Fix null pointer access when ramroute is full
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
688f0e9117
commit
54f3452293
@ -159,6 +159,11 @@ FAR struct net_route_ipv4_s *net_allocroute_ipv4(void)
|
||||
route = ramroute_ipv4_remfirst(&g_free_ipv4routes);
|
||||
|
||||
net_unlock();
|
||||
if (!route)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &route->entry;
|
||||
}
|
||||
#endif
|
||||
@ -177,6 +182,11 @@ FAR struct net_route_ipv6_s *net_allocroute_ipv6(void)
|
||||
route = ramroute_ipv6_remfirst(&g_free_ipv6routes);
|
||||
|
||||
net_unlock();
|
||||
if (!route)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &route->entry;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user