]> 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, 9 Feb 2023 16:38:10 +0000 (17:38 +0100)
src/stream-tcp.c

index 6fe7c61426171a4b4c935f3a228b4e1806ad093a..9d57789a410327369d1038bf2b7ee1a99f6ced3a 100644 (file)
@@ -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;
 }