This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c6c7cf6bba5f1965314adda532554c6f520fdd47
Author: zhanghongyu <[email protected]>
AuthorDate: Mon Apr 13 14:36:31 2026 +0800

    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 <[email protected]>
---
 net/netlink/netlink_route.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netlink/netlink_route.c b/net/netlink/netlink_route.c
index 126a885f5a3..7d6baed49b3 100644
--- a/net/netlink/netlink_route.c
+++ b/net/netlink/netlink_route.c
@@ -694,6 +694,7 @@ netlink_get_neighbor(FAR const void *neigh, int domain, int 
type,
     {
       if (neigh == NULL)
         {
+          kmm_free(alloc);
           return NULL;
         }
 

Reply via email to