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.
{
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);
FlowFreeStorage(f);
- if (f->flags & FLOW_HAS_EXPECTATION)
- AppLayerExpectationClean(f);
-
FLOW_RECYCLE(f);
SCReturnInt(1);