flow/bypass: clear memory on bypass

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.
pull/6539/head
Victor Julien 4 years ago
parent b19d1df69f
commit 536291054c

@ -562,7 +562,12 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data)
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);

Loading…
Cancel
Save