summaryrefslogtreecommitdiffstats
path: root/slirp/tcp_subr.c
diff options
context:
space:
mode:
authorSteven Luo <steven+qemu@steven676.net>2016-04-06 22:04:21 -0700
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:35 -0600
commit0268ceb903cee877b1d4dbbe8f60c4a66ec6018b (patch)
treecbff1cb780bb86bb79fb8096f5a0798d279bb196 /slirp/tcp_subr.c
parent335061c20059086f2f4eaa8e1213fcb11a9c41d2 (diff)
downloadhqemu-0268ceb903cee877b1d4dbbe8f60c4a66ec6018b.zip
hqemu-0268ceb903cee877b1d4dbbe8f60c4a66ec6018b.tar.gz
slirp: don't crash when tcp_sockclosed() is called with a NULL tp
Signed-off-by: Steven Luo <steven+qemu@steven676.net> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/tcp_subr.c')
-rw-r--r--slirp/tcp_subr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index dbfd2c6..32ff452 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -356,6 +356,10 @@ tcp_sockclosed(struct tcpcb *tp)
DEBUG_CALL("tcp_sockclosed");
DEBUG_ARG("tp = %p", tp);
+ if (!tp) {
+ return;
+ }
+
switch (tp->t_state) {
case TCPS_CLOSED:
@@ -374,8 +378,7 @@ tcp_sockclosed(struct tcpcb *tp)
tp->t_state = TCPS_LAST_ACK;
break;
}
- if (tp)
- tcp_output(tp);
+ tcp_output(tp);
}
/*
OpenPOWER on IntegriCloud