unix/dgram: don't leak file descriptors when socket write failed

This commit is contained in:
Gleb Smirnoff 2022-09-30 13:26:14 -07:00
parent 1d5ebad06c
commit 636420bde3

View File

@ -1338,6 +1338,8 @@ uipc_sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio,
} else {
soroverflow_locked(so2);
error = (so->so_state & SS_NBIO) ? EAGAIN : ENOBUFS;
if (f->m_next->m_type == MT_CONTROL)
unp_scan(f->m_next, unp_freerights);
}
if (addr != NULL)