]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: move state queue code into util func
authorVictor Julien <vjulien@oisf.net>
Thu, 9 Feb 2023 15:35:53 +0000 (16:35 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 2 Mar 2023 16:32:33 +0000 (17:32 +0100)
(cherry picked from commit 288086af3feb40318784b5fa1e92d73c11081481)

src/stream-tcp.c

index 859e9d408f9278d16a7c24645aef5081026f7c69..d2ab48924aa01ff8bbe755108269a9e36274f980 100644 (file)
@@ -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;
 }