]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: cleanup expectations first 4881/head
authorVictor Julien <victor@inliniac.net>
Fri, 3 Apr 2020 08:09:07 +0000 (10:09 +0200)
committerShivani Bhardwaj <shivanib134@gmail.com>
Sat, 25 Apr 2020 19:59:22 +0000 (01:29 +0530)
Make sure to cleanup expectations for a flow as the first step, before
parts of the flow itself are getting cleaned/freed.

Also indicate use unlikely as flows with expectations should be relatively
rare.

(cherry picked from commit 09a21545ce00de8ef161f097603f98770351e9be)

src/flow.c

index b45ec518e369619e0ff3a9e1a184c6962b06f0ac..922c85593d284c6bcb93b6ae9b945a89c69cf2ac 100644 (file)
@@ -975,6 +975,10 @@ int FlowClearMemory(Flow* f, uint8_t proto_map)
 {
     SCEnter();
 
+    if (unlikely(f->flags & FLOW_HAS_EXPECTATION)) {
+        AppLayerExpectationClean(f);
+    }
+
     /* call the protocol specific free function if we have one */
     if (flow_freefuncs[proto_map].Freefunc != NULL) {
         flow_freefuncs[proto_map].Freefunc(f->protoctx);