From c6e902a43ad48fbaa0669e3cc4deec77ec280c71 Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Fri, 30 Aug 2024 19:11:50 +0200 Subject: [PATCH] filter_alter_size: fixed memory leak Signed-off-by: leonardo-albertovich --- plugins/filter_alter_size/alter_size.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/filter_alter_size/alter_size.c b/plugins/filter_alter_size/alter_size.c index e4f5693ea2b..75e50052bf3 100644 --- a/plugins/filter_alter_size/alter_size.c +++ b/plugins/filter_alter_size/alter_size.c @@ -51,6 +51,8 @@ static int cb_alter_size_init(struct flb_filter_instance *ins, if (ctx->log_decoder == NULL) { flb_plg_error(ins, "could not initialize event decoder"); + flb_free(ctx); + return -1; } @@ -58,7 +60,9 @@ static int cb_alter_size_init(struct flb_filter_instance *ins, if (ctx->log_encoder == NULL) { flb_plg_error(ins, "could not initialize event encoder"); + flb_log_event_decoder_destroy(ctx->log_decoder); + flb_free(ctx); return -1; }