]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: only do flow dependent cleanup if a flow is present
authorVictor Julien <victor@inliniac.net>
Mon, 27 Feb 2017 22:28:46 +0000 (23:28 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 20 Apr 2017 15:41:11 +0000 (17:41 +0200)
src/detect.c

index e5e96d0e22c3677f194561c32e9503412f45677b..edce8a1a1bcf509b4bcc36e5b29892625ea1b447 100644 (file)
@@ -1403,10 +1403,6 @@ end:
     /* cleanup pkt specific part of the patternmatcher */
     PacketPatternCleanup(th_v, det_ctx);
 
-    DetectEngineCleanHCBDBuffers(det_ctx);
-    DetectEngineCleanHSBDBuffers(det_ctx);
-    DetectEngineCleanSMTPBuffers(det_ctx);
-
     /* store the found sgh (or NULL) in the flow to save us from looking it
      * up again for the next packet. Also return any stream chunk we processed
      * to the pool. */
@@ -1421,10 +1417,13 @@ end:
         }
 
         /* update inspected tracker for raw reassembly */
-        if (p->proto == IPPROTO_TCP && pflow->protoctx != NULL)
-        {
+        if (p->proto == IPPROTO_TCP && pflow->protoctx != NULL) {
             StreamReassembleRawUpdateProgress(pflow->protoctx, p,
                     det_ctx->raw_stream_progress);
+
+            DetectEngineCleanHCBDBuffers(det_ctx);
+            DetectEngineCleanHSBDBuffers(det_ctx);
+            DetectEngineCleanSMTPBuffers(det_ctx);
         }
     }
     PACKET_PROFILING_DETECT_END(p, PROF_DETECT_CLEANUP);