From: Victor Julien Date: Fri, 3 Apr 2020 08:09:07 +0000 (+0200) Subject: flow: cleanup expectations first X-Git-Tag: suricata-4.1.8~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4881%2Fhead;p=thirdparty%2Fsuricata.git flow: cleanup expectations first 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) --- diff --git a/src/flow.c b/src/flow.c index b45ec518e3..922c85593d 100644 --- a/src/flow.c +++ b/src/flow.c @@ -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);