diff options
author | Steven Luo <steven+qemu@steven676.net> | 2016-04-06 22:04:21 -0700 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 20:01:35 -0600 |
commit | 0268ceb903cee877b1d4dbbe8f60c4a66ec6018b (patch) | |
tree | cbff1cb780bb86bb79fb8096f5a0798d279bb196 /slirp/tcp_subr.c | |
parent | 335061c20059086f2f4eaa8e1213fcb11a9c41d2 (diff) | |
download | hqemu-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.c | 7 |
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); } /* |