Previously the flow would hold on to the app-layer and segment data
until the end of the flow, even though it would never be accessed again.
This patch clears app-layer and stream data, but not stream ssn as its
used in flow logging.
Bug: #4778.
if (p->flow != NULL) {
DEBUG_ASSERT_FLOW_LOCKED(p->flow);
- if (p->proto == IPPROTO_TCP) {
+ if (FlowIsBypassed(p->flow)) {
+ FlowCleanupAppLayer(p->flow);
+ if (p->proto == IPPROTO_TCP) {
+ StreamTcpSessionCleanup(p->flow->protoctx);
+ }
+ } else if (p->proto == IPPROTO_TCP && p->flow->protoctx) {
FLOWWORKER_PROFILING_START(p, PROFILE_FLOWWORKER_TCPPRUNE);
StreamTcpPruneSession(p->flow, p->flowflags & FLOW_PKT_TOSERVER ?
STREAM_TOSERVER : STREAM_TOCLIENT);