From 59df740e851868c58b4731b83a756f91495a2370 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 25 Apr 2023 07:23:58 +0200 Subject: [PATCH] output: work around scan-build fp runmodes.c:541:13: warning: Use of memory after it is freed [unix.Malloc] if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL) ^~~~~~~~~~~~~~~~~~ 1 warning generated. --- src/runmodes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/runmodes.c b/src/runmodes.c index c36dcf45ee..60e68dcd64 100644 --- a/src/runmodes.c +++ b/src/runmodes.c @@ -535,13 +535,11 @@ static void RunOutputFreeList(void) { OutputFreeList *output; while ((output = TAILQ_FIRST(&output_free_list))) { - SCLogDebug("output %s %p %p", output->output_module->name, output, - output->output_ctx); + TAILQ_REMOVE(&output_free_list, output, entries); + SCLogDebug("output %s %p %p", output->output_module->name, output, output->output_ctx); if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL) output->output_ctx->DeInit(output->output_ctx); - - TAILQ_REMOVE(&output_free_list, output, entries); SCFree(output); } }