You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/12/03 11:23:14 UTC

[incubator-nuttx] 01/02: net/igmp: add sanity check to handle allocate fail

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

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

commit ab78bae12f13535bdbf18aaa716688a370ad8ccb
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Nov 30 14:35:11 2020 +0800

    net/igmp: add sanity check to handle allocate fail
    
    Change-Id: Ia3128c9c2b219345fb6ac2789ece7760c6aee663
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 net/igmp/igmp_join.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/igmp/igmp_join.c b/net/igmp/igmp_join.c
index c87f231..1e8876d 100644
--- a/net/igmp/igmp_join.c
+++ b/net/igmp/igmp_join.c
@@ -135,6 +135,11 @@ int igmp_joingroup(struct net_driver_s *dev,
 
       ninfo("Join to new group: %08" PRIx32 "\n", (uint32_t)grpaddr->s_addr);
       group = igmp_grpalloc(dev, &grpaddr->s_addr);
+      if (group == NULL)
+        {
+          return -EADDRNOTAVAIL;
+        }
+
       IGMP_STATINCR(g_netstats.igmp.joins);
 
       /* Send the Membership Report */