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>
This commit is contained in:
Steven Luo 2016-04-06 22:04:21 -07:00 committed by Samuel Thibault
parent 7acbff99c6
commit b5ab677189

View File

@ -356,6 +356,10 @@ tcp_sockclosed(struct tcpcb *tp)
DEBUG_CALL("tcp_sockclosed"); DEBUG_CALL("tcp_sockclosed");
DEBUG_ARG("tp = %p", tp); DEBUG_ARG("tp = %p", tp);
if (!tp) {
return;
}
switch (tp->t_state) { switch (tp->t_state) {
case TCPS_CLOSED: case TCPS_CLOSED:
@ -374,8 +378,7 @@ tcp_sockclosed(struct tcpcb *tp)
tp->t_state = TCPS_LAST_ACK; tp->t_state = TCPS_LAST_ACK;
break; break;
} }
if (tp) tcp_output(tp);
tcp_output(tp);
} }
/* /*