Skip to content

Commit

Permalink
output: Remove unneeded NULL check
Browse files Browse the repository at this point in the history
Issue: 4974

Remove an unneeded NULL check for the JSON output context in
AlertJsonHeader because the caller presumes that it's non-NULL and
dereferences it to get the context flags.
  • Loading branch information
jlucovsky committed Jul 27, 2024
1 parent 921dd0a commit 2b27f92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/output-json-alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ void AlertJsonHeader(void *ctx, const Packet *p, const PacketAlert *pa, JsonBuil
AlertJsonSourceTarget(p, pa, js, addr);
}

if ((json_output_ctx != NULL) && (flags & LOG_JSON_REFERENCE)) {
if ((flags & LOG_JSON_REFERENCE)) {
AlertJsonReference(json_output_ctx, pa, js);
}

if ((json_output_ctx != NULL) && (flags & LOG_JSON_RULE_METADATA)) {
if (flags & LOG_JSON_RULE_METADATA) {
AlertJsonMetadata(json_output_ctx, pa, js);
}

Expand Down

0 comments on commit 2b27f92

Please sign in to comment.