--- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -797,8 +797,17 @@ #endif error = holdsock(td, s, &fp); - if (error) + if (error) { + /* + * DF-5830: Take ownership of the control mbuf on this + * early error return so sys_sendmsg() does not leak it. + * This matches the all-paths consumption contract used + * by sosend(). + */ + if (control) + m_freem(control); return (error); + } #ifdef KTRACE if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio->uio_iovcnt * sizeof (struct iovec);