diff --git a/src/stream-tcp.c b/src/stream-tcp.c index a7619e5dbd..f17a761369 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -165,6 +165,14 @@ int StreamTcpCheckMemcap(uint64_t size) return 0; } +void StreamTcpStreamCleanup(TcpStream *stream) +{ + if (stream != NULL) { + StreamTcpSackFreeList(stream); + StreamTcpReturnStreamSegments(stream); + } +} + /** * \brief Session cleanup function. Does not free the ssn. * \param ssn tcp session @@ -179,11 +187,8 @@ void StreamTcpSessionCleanup(TcpSession *ssn) if (ssn == NULL) return; - StreamTcpSackFreeList(&ssn->client); - StreamTcpSackFreeList(&ssn->server); - - StreamTcpReturnStreamSegments(&ssn->client); - StreamTcpReturnStreamSegments(&ssn->server); + StreamTcpStreamCleanup(&ssn->client); + StreamTcpStreamCleanup(&ssn->server); /* if we have (a) smsg(s), return to the pool */ smsg = ssn->toserver_smsg_head; diff --git a/src/stream-tcp.h b/src/stream-tcp.h index dc3ccbf676..416cd5aa80 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -229,6 +229,9 @@ int StreamTcpPacket (ThreadVars *tv, Packet *p, StreamTcpThread *stt, void StreamTcpSessionClear(void *ssnptr); /* cleanup ssn, but don't free ssn */ void StreamTcpSessionCleanup(TcpSession *ssn); +/* cleanup stream, but don't free the stream */ +void StreamTcpStreamCleanup(TcpStream *stream); + uint32_t StreamTcpGetStreamSize(TcpStream *stream);