Do not leak sa in linux_recvfrom() call if kern_recvit() fails.

MFC after:	1 week
This commit is contained in:
dchagin 2019-05-21 18:03:58 +00:00
parent c84facbfbd
commit 05ec103068

View File

@ -908,7 +908,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args)
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_recvfrom_args *args)
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);
}