Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 May 2019 18:03:59 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348056 - head/sys/compat/linux
Message-ID:  <201905211803.x4LI3xkm036724@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Tue May 21 18:03:58 2019
New Revision: 348056
URL: https://svnweb.freebsd.org/changeset/base/348056

Log:
  Do not leak sa in linux_recvfrom() 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 16:36:28 2019	(r348055)
+++ head/sys/compat/linux/linux_socket.c	Tue May 21 18:03:58 2019	(r348056)
@@ -908,7 +908,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro
 
 	error = kern_recvit(td, args->s, &msg, UIO_SYSSPACE, NULL);
 	if (error != 0)
-		return (error);
+		goto out;
 
 	if (PTRIN(args->from) != NULL) {
 		error = bsd_to_linux_sockaddr(sa, &lsa, msg.msg_namelen);
@@ -921,7 +921,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro
 	if (error == 0 && PTRIN(args->fromlen) != NULL)
 		error = copyout(&msg.msg_namelen, PTRIN(args->fromlen),
 		    sizeof(msg.msg_namelen));
-
+out:
 	free(sa, M_SONAME);
 	return (error);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905211803.x4LI3xkm036724>