]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: work around harmless coverity warnings
authorVictor Julien <victor@inliniac.net>
Tue, 25 Aug 2020 09:44:13 +0000 (11:44 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 25 Aug 2020 09:44:13 +0000 (11:44 +0200)
src/flow-hash.c

index 1a92f604d10d333be26be977646b17dd9cbc9652..ebbd836e81a0f5216378890a5977844bc19f97ef 100644 (file)
@@ -604,9 +604,13 @@ static Flow *TcpReuseReplace(ThreadVars *tv, FlowLookupStruct *fls,
                              FlowBucket *fb, Flow *old_f,
                              const uint32_t hash, const Packet *p)
 {
+#ifdef UNITTESTS
     if (tv != NULL && fls->dtv != NULL) {
+#endif
         StatsIncr(tv, fls->dtv->counter_flow_tcp_reuse);
+#ifdef UNITTESTS
     }
+#endif
     /* tag flow as reused so future lookups won't find it */
     old_f->flags |= FLOW_TCP_REUSED;
     /* time out immediately */
@@ -1089,8 +1093,15 @@ static Flow *FlowGetUsedFlow(ThreadVars *tv, DecodeThreadVars *dtv, const struct
             f->flow_end_flags |= FLOW_END_FLAG_EMERGENCY;
 
         /* invoke flow log api */
-        if (dtv && dtv->output_flow_thread_data)
-            (void)OutputFlowLog(tv, dtv->output_flow_thread_data, f);
+#ifdef UNITTESTS
+        if (dtv) {
+#endif
+            if (dtv->output_flow_thread_data) {
+                (void)OutputFlowLog(tv, dtv->output_flow_thread_data, f);
+            }
+#ifdef UNITTESTS
+        }
+#endif
 
         FlowClearMemory(f, f->protomap);