diff options
author | dchagin <dchagin@FreeBSD.org> | 2016-01-09 18:00:51 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2016-01-09 18:00:51 +0000 |
commit | 1e8561a8e3e93cb5e99ec1b6531703316e8b2dd9 (patch) | |
tree | 272a98a48c5e90b2c170a872b11242ff31d877b5 /sys/compat | |
parent | 6470ace45cf47211ba3bb8bf17420d0a247c9809 (diff) | |
download | FreeBSD-src-1e8561a8e3e93cb5e99ec1b6531703316e8b2dd9.zip FreeBSD-src-1e8561a8e3e93cb5e99ec1b6531703316e8b2dd9.tar.gz |
MFC r283494:
Fix an mbuf(9) leak in sendmsg() under failure condition and
remove unneeded check for failed M_WAITOK allocation.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_socket.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 5ee33a0..08a287b 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1092,8 +1092,6 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, 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, @@ -1165,6 +1163,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr, error = linux_sendit(td, s, &msg, flags, control, UIO_USERSPACE); bad: + m_freem(control); free(iov, M_IOV); if (cmsg) free(cmsg, M_LINUX); |