From: Victor Julien Date: Thu, 9 Feb 2023 15:35:53 +0000 (+0100) Subject: stream: move state queue code into util func X-Git-Tag: suricata-6.0.11~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66ddbc3a8b02f40e32cadbb89983f96868d19602;p=thirdparty%2Fsuricata.git stream: move state queue code into util func (cherry picked from commit 288086af3feb40318784b5fa1e92d73c11081481) --- diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 859e9d408f..d2ab48924a 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -211,6 +211,20 @@ void StreamTcpStreamCleanup(TcpStream *stream) } } +static void StreamTcp3wsFreeQueue(TcpSession *ssn) +{ + TcpStateQueue *q, *q_next; + q = ssn->queue; + while (q != NULL) { + q_next = q->next; + SCFree(q); + q = q_next; + StreamTcpDecrMemuse((uint64_t)sizeof(TcpStateQueue)); + } + ssn->queue = NULL; + ssn->queue_len = 0; +} + /** * \brief Session cleanup function. Does not free the ssn. * \param ssn tcp session @@ -218,23 +232,13 @@ void StreamTcpStreamCleanup(TcpStream *stream) void StreamTcpSessionCleanup(TcpSession *ssn) { SCEnter(); - TcpStateQueue *q, *q_next; if (ssn == NULL) return; StreamTcpStreamCleanup(&ssn->client); StreamTcpStreamCleanup(&ssn->server); - - q = ssn->queue; - while (q != NULL) { - q_next = q->next; - SCFree(q); - q = q_next; - StreamTcpDecrMemuse((uint64_t)sizeof(TcpStateQueue)); - } - ssn->queue = NULL; - ssn->queue_len = 0; + StreamTcp3wsFreeQueue(ssn); SCReturn; }