diff --git a/net/local/local_accept.c b/net/local/local_accept.c index 8d4bec5e8f..c951b8852a 100644 --- a/net/local/local_accept.c +++ b/net/local/local_accept.c @@ -170,6 +170,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr, conn->lc_psock = psock; #ifdef CONFIG_NET_LOCAL_SCM conn->lc_peer = client; + client->lc_peer = conn; #endif /* CONFIG_NET_LOCAL_SCM */ strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1); diff --git a/net/local/local_conn.c b/net/local/local_conn.c index c968cca9e0..a32c87492e 100644 --- a/net/local/local_conn.c +++ b/net/local/local_conn.c @@ -176,6 +176,7 @@ void local_free(FAR struct local_conn_s *conn) if (local_peerconn(conn) && conn->lc_peer) { conn->lc_peer->lc_peer = NULL; + conn->lc_peer = NULL; } #endif /* CONFIG_NET_LOCAL_SCM */ diff --git a/net/local/local_connect.c b/net/local/local_connect.c index 1c3f407ae6..b3aff310a1 100644 --- a/net/local/local_connect.c +++ b/net/local/local_connect.c @@ -301,9 +301,6 @@ int psock_local_connect(FAR struct socket *psock, UNIX_PATH_MAX - 1); client->lc_path[UNIX_PATH_MAX - 1] = '\0'; client->lc_instance_id = local_generate_instance_id(); -#ifdef CONFIG_NET_LOCAL_SCM - client->lc_peer = conn; -#endif /* CONFIG_NET_LOCAL_SCM */ /* The client is now bound to an address */