svn commit: r348058 - head/sys/compat/linux
Dmitry Chagin
dchagin at FreeBSD.org
Tue May 21 18:08:20 UTC 2019
Author: dchagin
Date: Tue May 21 18:08:19 2019
New Revision: 348058
URL: https://svnweb.freebsd.org/changeset/base/348058
Log:
Do not leak sa in linux_recvmsg() call if kern_recvit() fails.
MFC after: 1 week
Modified:
head/sys/compat/linux/linux_socket.c
Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c Tue May 21 18:05:57 2019 (r348057)
+++ head/sys/compat/linux/linux_socket.c Tue May 21 18:08:19 2019 (r348058)
@@ -1155,7 +1155,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
if (msg->msg_name) {
sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK);
msg->msg_name = sa;
- }
+ } else
+ sa = NULL;
uiov = msg->msg_iov;
msg->msg_iov = iov;
@@ -1172,7 +1173,6 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
error = copyout(lsa, PTRIN(msg->msg_name),
msg->msg_namelen);
free(lsa, M_SONAME);
- free(sa, M_SONAME);
if (error != 0)
goto bad;
}
@@ -1292,6 +1292,7 @@ bad:
}
free(iov, M_IOV);
free(linux_cmsg, M_LINUX);
+ free(sa, M_SONAME);
return (error);
}
More information about the svn-src-all
mailing list