net/local: fix used after free

now the lc_path of the client will not be the same as that of the server.
therefore, accept->peer = NULL will not be set when the client release
the conn, then when release accept conn, set
client->peer(accept->peer->peer) = NULL will cause used after free

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2024-10-18 21:15:27 +08:00 committed by Xiang Xiao
parent 112b8cf470
commit 824dfacd08
1 changed files with 1 additions and 1 deletions

View File

@ -299,7 +299,7 @@ void local_free(FAR struct local_conn_s *conn)
dq_rem(&conn->lc_conn.node, &g_local_connections); dq_rem(&conn->lc_conn.node, &g_local_connections);
if (local_peerconn(conn) && conn->lc_peer) if (conn->lc_peer)
{ {
conn->lc_peer->lc_peer = NULL; conn->lc_peer->lc_peer = NULL;
conn->lc_peer = NULL; conn->lc_peer = NULL;