mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 05:16:47 +08:00
net/netlink: fix memory leak in netlink_get_neighbor
Add kmm_free(alloc) before returning NULL when neigh is NULL in netlink_get_neighbor(). Without this, the allocated memory is leaked on the error path. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
244ddfcc2c
commit
c6c7cf6bba
@@ -694,6 +694,7 @@ netlink_get_neighbor(FAR const void *neigh, int domain, int type,
|
||||
{
|
||||
if (neigh == NULL)
|
||||
{
|
||||
kmm_free(alloc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user