From 52021a530076ada23a5b26faceefa80df51a04f9 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 9 Nov 2018 15:22:25 -0600 Subject: [PATCH] net/icmpv6/icmpv6_conn.c: icmpv6_free() remove reference count operation since it's already done in icmpv6_close(). --- net/icmpv6/icmpv6_conn.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/net/icmpv6/icmpv6_conn.c b/net/icmpv6/icmpv6_conn.c index 00b1e9075d..b780147578 100644 --- a/net/icmpv6/icmpv6_conn.c +++ b/net/icmpv6/icmpv6_conn.c @@ -170,27 +170,14 @@ void icmpv6_free(FAR struct icmpv6_conn_s *conn) UNUSED(ret); - /* Is this the last reference on the connection? It might not be if the - * socket was cloned. - */ + /* Remove the connection from the active list */ - if (conn->crefs > 1) - { - /* No.. just decrement the reference count */ + dq_rem(&conn->node, &g_active_icmpv6_connections); - conn->crefs--; - } - else - { - /* Remove the connection from the active list */ + /* Free the connection */ - dq_rem(&conn->node, &g_active_icmpv6_connections); - - /* Free the connection */ - - dq_addlast(&conn->node, &g_free_icmpv6_connections); - nxsem_post(&g_free_sem); - } + dq_addlast(&conn->node, &g_free_icmpv6_connections); + nxsem_post(&g_free_sem); } /****************************************************************************