From 7e389a5257c780f11ed1adc29cb4031bf380ba37 Mon Sep 17 00:00:00 2001 From: Jesse Rittner Date: Wed, 7 Jul 2021 12:52:38 -0400 Subject: [PATCH] out_s3: fix use-after-free in destructor Signed-off-by: Jesse Rittner --- plugins/out_s3/s3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/out_s3/s3.c b/plugins/out_s3/s3.c index 0e886b3f2e2..aa81b3b3415 100644 --- a/plugins/out_s3/s3.c +++ b/plugins/out_s3/s3.c @@ -307,14 +307,14 @@ static void s3_context_destroy(struct flb_s3 *ctx) flb_tls_destroy(ctx->sts_provider_tls); } - if (ctx->client_tls) { - flb_tls_destroy(ctx->client_tls); - } - if (ctx->s3_client) { flb_aws_client_destroy(ctx->s3_client); } + if (ctx->client_tls) { + flb_tls_destroy(ctx->client_tls); + } + if (ctx->free_endpoint == FLB_TRUE) { flb_free(ctx->endpoint); }