diff options
-rw-r--r-- | sys/kern/uipc_syscalls.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index f1e7f79..ca770b8 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -2364,7 +2364,7 @@ sctp_generic_sendmsg (td, uap) #ifdef SCTP struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; - struct file *fp; + struct file *fp = NULL; int use_rcvinfo = 1; int error = 0, len; struct sockaddr *to = NULL; @@ -2436,7 +2436,8 @@ sctp_generic_sendmsg (td, uap) } #endif /* KTRACE */ sctp_bad: - fdrop(fp, td); + if (fp) + fdrop(fp, td); sctp_bad2: if (to) free(to, M_SONAME); @@ -2462,7 +2463,7 @@ sctp_generic_sendmsg_iov(td, uap) #ifdef SCTP struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; struct socket *so; - struct file *fp; + struct file *fp = NULL; int use_rcvinfo = 1; int error=0, len, i; struct sockaddr *to = NULL; @@ -2544,7 +2545,8 @@ sctp_generic_sendmsg_iov(td, uap) sctp_bad: free(iov, M_IOV); sctp_bad1: - fdrop(fp, td); + if (fp) + fdrop(fp, td); sctp_bad2: if (to) free(to, M_SONAME); @@ -2573,7 +2575,7 @@ sctp_generic_recvmsg(td, uap) struct iovec *iov, *tiov; struct sctp_sndrcvinfo sinfo; struct socket *so; - struct file *fp; + struct file *fp = NULL; struct sockaddr *fromsa; int fromlen; int len, i, msg_flags; @@ -2684,7 +2686,9 @@ sctp_generic_recvmsg(td, uap) out: free(iov, M_IOV); out1: - fdrop(fp, td); + if (fp) + fdrop(fp, td); + return (error); #else /* SCTP */ return (EOPNOTSUPP); |