Date: Sat, 28 Feb 2015 20:57:04 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r279407 - user/dchagin/lemul/sys/compat/linux Message-ID: <201502282057.t1SKv4XO081455@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sat Feb 28 20:57:03 2015 New Revision: 279407 URL: https://svnweb.freebsd.org/changeset/base/279407 Log: Fix an mbuf(9) leak in sendmsg() under failure condition and remove unneeded check for failed M_WAITOK allocation. Found by: Brainy Code Scanner Reported by: Maxime Villard <max@M00nBSD.net> Modified: user/dchagin/lemul/sys/compat/linux/linux_socket.c Modified: user/dchagin/lemul/sys/compat/linux/linux_socket.c ============================================================================== --- user/dchagin/lemul/sys/compat/linux/linux_socket.c Sat Feb 28 20:37:38 2015 (r279406) +++ user/dchagin/lemul/sys/compat/linux/linux_socket.c Sat Feb 28 20:57:03 2015 (r279407) @@ -1087,8 +1087,6 @@ linux_sendmsg_common(struct thread *td, error = ENOBUFS; cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK|M_ZERO); control = m_get(M_WAITOK, MT_CONTROL); - if (control == NULL) - goto bad; do { error = copyin(ptr_cmsg, &linux_cmsg, @@ -1160,6 +1158,7 @@ linux_sendmsg_common(struct thread *td, error = linux_sendit(td, s, &msg, flags, control, UIO_USERSPACE); bad: + m_freem(control); free(iov, M_IOV); if (cmsg) free(cmsg, M_LINUX);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502282057.t1SKv4XO081455>