Skip to content

Commit

Permalink
output-json-email: fix error code
Browse files Browse the repository at this point in the history
Returning early if first function call fail could avoid some issue.
  • Loading branch information
regit authored and victorjulien committed Mar 21, 2016
1 parent b5972ee commit 92ad63a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/output-json-email-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ TmEcode JsonEmailLogJson(JsonEmailLogThread *aft, json_t *js, const Packet *p, F
OutputJsonEmailCtx *email_ctx = aft->emaillog_ctx;
SMTPTransaction *tx = (SMTPTransaction *) vtx;

if (sjs == NULL) {
SCReturnInt(TM_ECODE_FAILED);
}

if ((email_ctx->flags & LOG_EMAIL_EXTENDED) || (email_ctx->fields != 0))
JsonEmailLogJSONCustom(email_ctx, sjs, tx);

Expand Down

0 comments on commit 92ad63a

Please sign in to comment.