diff --git a/net/local/local_conn.c b/net/local/local_conn.c index d8797c53fa..834bd23ce0 100644 --- a/net/local/local_conn.c +++ b/net/local/local_conn.c @@ -118,9 +118,10 @@ FAR struct local_conn_s *local_alloc(void) * necessary to zerio-ize any structure elements. */ + conn->lc_crefs = 1; + #ifdef CONFIG_NET_LOCAL_STREAM nxsem_init(&conn->lc_waitsem, 0, 0); - #endif /* This semaphore is used for sending safely in multithread. @@ -174,10 +175,6 @@ int local_alloc_accept(FAR struct local_conn_s *server, return -ENOMEM; } - /* Initialize the new connection structure */ - - local_addref(conn); - conn->lc_proto = SOCK_STREAM; conn->lc_type = LOCAL_TYPE_PATHNAME; conn->lc_state = LOCAL_STATE_CONNECTED; diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index 0b57ba0049..847aa2e258 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -139,12 +139,6 @@ static int local_sockif_alloc(FAR struct socket *psock) return -ENOMEM; } - /* Set the reference count on the connection structure. This reference - * count will be incremented only if the socket is dup'ed - */ - - local_addref(conn); - /* Save the pre-allocated connection in the socket structure */ psock->s_conn = conn;