diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index a14a85570e76..fd63b993f04a 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -766,8 +766,11 @@ syncache_expand(inc, th, sop, m) /* * If seg contains an ACK, but not for our SYN/ACK, send a RST. */ - if (th->th_ack != sc->sc_iss + 1) + if (th->th_ack != sc->sc_iss + 1) { + if (sch == NULL) + syncache_free(sc); return (0); + } so = syncache_socket(sc, *sop, m); if (so == NULL) {