From 3535cdbc025f1ba0b8f05adb2ac6e03f3710ec2f Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Sun, 11 Apr 2021 12:20:15 -0400 Subject: [PATCH] output/log: Ensure files closed in threaded mode This commit ensures that file objects are closed in threaded mode. (cherry picked from commit 38ae21a19691466b078a6201494df893bc91308c) --- src/util-logopenfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 0de413aaff..0899b8cf3b 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -1,5 +1,5 @@ /* vi: set et ts=4: */ -/* Copyright (C) 2007-2020 Open Information Security Foundation +/* Copyright (C) 2007-2021 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -304,6 +304,7 @@ static char *SCLogFilenameFromPattern(const char *pattern) static void SCLogFileCloseNoLock(LogFileCtx *log_ctx) { + SCLogDebug("Closing %s", log_ctx->filename); if (log_ctx->fp) fclose(log_ctx->fp); @@ -820,6 +821,7 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx) for(int i = 0; i < lf_ctx->threads->slot_count; i++) { if (lf_ctx->threads->lf_slots[i]) { OutputUnregisterFileRotationFlag(&lf_ctx->threads->lf_slots[i]->rotation_flag); + lf_ctx->threads->lf_slots[i]->Close(lf_ctx->threads->lf_slots[i]); SCFree(lf_ctx->threads->lf_slots[i]->filename); SCFree(lf_ctx->threads->lf_slots[i]); } -- 2.47.2