aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Luo <steven+qemu@steven676.net>2016-04-06 22:04:21 -0700
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-04-07 10:27:22 +0200
commit804f441a9d6998a57040bf36685a17a6436b2ea8 (patch)
treeddf1ae866354901ece4372d209b2da8fdacb9c95
parent8a21a4aabf12e599098e33a46204323098fd3f12 (diff)
downloadslirp-804f441a9d6998a57040bf36685a17a6436b2ea8.zip
slirp-804f441a9d6998a57040bf36685a17a6436b2ea8.tar.gz
slirp-804f441a9d6998a57040bf36685a17a6436b2ea8.tar.bz2
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>
-rw-r--r--tcp_subr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tcp_subr.c b/tcp_subr.c
index fe19cf7..270e362 100644
--- a/tcp_subr.c
+++ b/tcp_subr.c
@@ -355,6 +355,10 @@ void tcp_sockclosed(struct tcpcb *tp)
DEBUG_CALL("tcp_sockclosed");
DEBUG_ARG("tp = %p", tp);
+ if (!tp) {
+ return;
+ }
+
switch (tp->t_state) {
case TCPS_CLOSED:
case TCPS_LISTEN:
@@ -372,8 +376,7 @@ void tcp_sockclosed(struct tcpcb *tp)
tp->t_state = TCPS_LAST_ACK;
break;
}
- if (tp)
- tcp_output(tp);
+ tcp_output(tp);
}
/*