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

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

commit 873023f89b6fd018479c906bf142b5d1456720dd
Author: chao an <anc...@xiaomi.com>
AuthorDate: Sun Nov 20 23:11:18 2022 +0800

    net/icmp[v6]: destroy nxsem properly
    
    Signed-off-by: chao an <anc...@xiaomi.com>
---
 net/icmp/icmp_recvmsg.c     | 2 ++
 net/icmp/icmp_sendmsg.c     | 2 ++
 net/icmpv6/icmpv6_recvmsg.c | 2 ++
 net/icmpv6/icmpv6_sendmsg.c | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/net/icmp/icmp_recvmsg.c b/net/icmp/icmp_recvmsg.c
index 38c56d4ca6..000a5e5bd9 100644
--- a/net/icmp/icmp_recvmsg.c
+++ b/net/icmp/icmp_recvmsg.c
@@ -449,6 +449,8 @@ ssize_t icmp_recvmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
           icmp_callback_free(dev, conn, state.recv_cb);
         }
 
+      nxsem_destroy(&state.recv_sem);
+
       /* Return the negated error number in the event of a failure, or the
        * number of bytes received on success.
        */
diff --git a/net/icmp/icmp_sendmsg.c b/net/icmp/icmp_sendmsg.c
index 4ac4e63117..fb0fc659bf 100644
--- a/net/icmp/icmp_sendmsg.c
+++ b/net/icmp/icmp_sendmsg.c
@@ -445,6 +445,8 @@ ssize_t icmp_sendmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
       icmp_callback_free(dev, conn, state.snd_cb);
     }
 
+  nxsem_destroy(&state.snd_sem);
+
   net_unlock();
 
   /* Return the negated error number in the event of a failure, or the
diff --git a/net/icmpv6/icmpv6_recvmsg.c b/net/icmpv6/icmpv6_recvmsg.c
index 9933f0c02a..9a805586ad 100644
--- a/net/icmpv6/icmpv6_recvmsg.c
+++ b/net/icmpv6/icmpv6_recvmsg.c
@@ -456,6 +456,8 @@ ssize_t icmpv6_recvmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
           icmpv6_callback_free(dev, conn, state.recv_cb);
         }
 
+      nxsem_destroy(&state.recv_sem);
+
       /* Return the negated error number in the event of a failure, or the
        * number of bytes received on success.
        */
diff --git a/net/icmpv6/icmpv6_sendmsg.c b/net/icmpv6/icmpv6_sendmsg.c
index 98c9d2eea0..2e5f2d9943 100644
--- a/net/icmpv6/icmpv6_sendmsg.c
+++ b/net/icmpv6/icmpv6_sendmsg.c
@@ -426,6 +426,8 @@ ssize_t icmpv6_sendmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
       icmpv6_callback_free(dev, conn, state.snd_cb);
     }
 
+  nxsem_destroy(&state.snd_sem);
+
   net_unlock();
 
   /* Return the negated error number in the event of a failure, or the

Reply via email to