aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2019-05-21 18:08:19 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2019-05-21 18:08:19 +0000
commit8128cfc59ed7c5ce8331ec3e87e0ef67362cd2cc (patch)
tree6d580c727a9f7fe6bb698ac6448132738258fca1 /sys/compat/linux
parent57cb29a73eb05208c26f8a7307550297f741c8d8 (diff)
Notes
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 12db1a0dd5ab..1c53db647aff 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1155,7 +1155,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
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, struct l_msghdr *msghdr,
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);
}