From 288086af3feb40318784b5fa1e92d73c11081481 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 9 Feb 2023 16:35:53 +0100 Subject: [PATCH] stream: move state queue code into util func --- src/stream-tcp.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/stream-tcp.c b/src/stream-tcp.c index 6fe7c61426..9d57789a41 100644 --- a/src/stream-tcp.c +++ b/src/stream-tcp.c @@ -204,6 +204,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 @@ -211,23 +225,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; } -- 2.47.2