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:
zhanghongyu
2026-04-13 14:36:31 +08:00
committed by Alan C. Assis
parent 244ddfcc2c
commit c6c7cf6bba
+1
View File
@@ -694,6 +694,7 @@ netlink_get_neighbor(FAR const void *neigh, int domain, int type,
{
if (neigh == NULL)
{
kmm_free(alloc);
return NULL;
}