net/udp: fix conn_unlock not called outside conditional block

Move conn_unlock() call outside the if block in psock_udp_sendto()
to ensure the connection lock is always released before returning,
preventing a potential deadlock when the condition is not met.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2026-04-08 21:26:07 +08:00 committed by Xiang Xiao
parent 54ee939f82
commit faa4d7ff8d

View file

@ -895,10 +895,10 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
conn_unlock(&conn->sconn);
goto errout_with_wrb;
}
conn_unlock(&conn->sconn);
}
conn_unlock(&conn->sconn);
/* Return the number of bytes that will be sent */
return len;