]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: minor optimization
authorVictor Julien <vjulien@oisf.net>
Wed, 3 Jan 2024 11:16:25 +0000 (12:16 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Jan 2024 19:23:28 +0000 (20:23 +0100)
Most of the time FlowGetFlowFromHash will succeed.

src/flow.c

index 9783b7883b0bb88e7daa87de6c704cb558848349..a7f4788150ed9d9bb1eafbc7cfa2d2f02e1a958e 100644 (file)
@@ -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