]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve/alert: minor cleanups 5164/head
authorVictor Julien <victor@inliniac.net>
Fri, 10 Jul 2020 13:31:24 +0000 (15:31 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jul 2020 13:32:20 +0000 (15:32 +0200)
src/output-json-alert.c

index b136fca05cc3108d49be1330e449d85fa22511c9..070e27f2768936555371355b96930aa77a696781 100644 (file)
@@ -530,12 +530,10 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
     MemBuffer *payload = aft->payload_buffer;
     AlertJsonOutputCtx *json_output_ctx = aft->json_output_ctx;
 
-    int i;
-
     if (p->alerts.cnt == 0 && !(p->flags & PKT_HAS_TAG))
         return TM_ECODE_OK;
 
-    for (i = 0; i < p->alerts.cnt; i++) {
+    for (int i = 0; i < p->alerts.cnt; i++) {
         const PacketAlert *pa = &p->alerts.alerts[i];
         if (unlikely(pa->s == NULL)) {
             continue;
@@ -596,9 +594,7 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
             if (json_output_ctx->flags & LOG_JSON_RULE_METADATA) {
                 AlertAddFiles(p, jb, pa->tx_id);
             }
-        }
 
-        if (p->flow) {
             EveAddAppProto(p->flow, jb);
             if (json_output_ctx->flags & LOG_JSON_FLOW) {
                 jb_open_object(jb, "flow");