From 982bbc2a8b21e3fe79ef3ccf828e5b749880ab91 Mon Sep 17 00:00:00 2001 From: Takahiro Yamashita Date: Sat, 15 Oct 2022 07:55:32 +0900 Subject: [PATCH] out_forward: release buf when no connection available and time_as_integer is true (#6082) Signed-off-by: Takahiro Yamashita --- plugins/out_forward/forward.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/out_forward/forward.c b/plugins/out_forward/forward.c index 08a7f784d78..4e6b6e9f48c 100644 --- a/plugins/out_forward/forward.c +++ b/plugins/out_forward/forward.c @@ -1254,7 +1254,6 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk, int mode; msgpack_packer mp_pck; msgpack_sbuffer mp_sbuf; - void *tmp_buf = NULL; void *out_buf = NULL; size_t out_size = 0; struct flb_forward *ctx = out_context; @@ -1309,7 +1308,7 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk, flb_plg_error(ctx->ins, "no upstream connections available"); msgpack_sbuffer_destroy(&mp_sbuf); if (fc->time_as_integer == FLB_TRUE) { - flb_free(tmp_buf); + flb_free(out_buf); } flb_free(flush_ctx); FLB_OUTPUT_RETURN(FLB_RETRY); @@ -1328,7 +1327,7 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk, } msgpack_sbuffer_destroy(&mp_sbuf); if (fc->time_as_integer == FLB_TRUE) { - flb_free(tmp_buf); + flb_free(out_buf); } flb_free(flush_ctx); FLB_OUTPUT_RETURN(FLB_RETRY);