Skip to content

Commit

Permalink
log: add NULL ptr guard on fclose when reopening.
Browse files Browse the repository at this point in the history
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@cognitix.de>
  • Loading branch information
Emmanuel Roullit authored and victorjulien committed Apr 3, 2019
1 parent f84667c commit 4b4bb31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/util-logopenfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ int SCConfLogReopen(LogFileCtx *log_ctx)
return -1;
}

fclose(log_ctx->fp);
if (log_ctx->fp != NULL) {
fclose(log_ctx->fp);
}

/* Reopen the file. Append is forced in case the file was not
* moved as part of a rotation process. */
Expand Down

0 comments on commit 4b4bb31

Please sign in to comment.