From: Victor Julien Date: Fri, 10 Jul 2020 13:31:24 +0000 (+0200) Subject: eve/alert: minor cleanups X-Git-Tag: suricata-6.0.0-beta1~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1673908ac47449294fce3e028b3f8261f4e40f0;p=thirdparty%2Fsuricata.git eve/alert: minor cleanups --- diff --git a/src/output-json-alert.c b/src/output-json-alert.c index b136fca05c..070e27f276 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -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");