From: Victor Julien Date: Wed, 3 Jan 2024 11:16:25 +0000 (+0100) Subject: flow: minor optimization X-Git-Tag: suricata-8.0.0-beta1~1851 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=609cac58b71c856598ad25610bd7463458cedad0;p=thirdparty%2Fsuricata.git flow: minor optimization Most of the time FlowGetFlowFromHash will succeed. --- diff --git a/src/flow.c b/src/flow.c index 9783b7883b..a7f4788150 100644 --- a/src/flow.c +++ b/src/flow.c @@ -536,12 +536,10 @@ void FlowHandlePacket(ThreadVars *tv, FlowLookupStruct *fls, Packet *p) * a new flow if necessary. If we get NULL, we're out of flow memory. * The returned flow is locked. */ Flow *f = FlowGetFlowFromHash(tv, fls, p, &p->flow); - if (f == NULL) - return; - - /* set the flow in the packet */ - p->flags |= PKT_HAS_FLOW; - return; + if (f != NULL) { + /* set the flow in the packet */ + p->flags |= PKT_HAS_FLOW; + } } /** \brief initialize the configuration