Skip to content

Commit a3c457f

Browse files
ShelbyZcosmo0920
authored andcommitted
filter_kubernetes: Adjust cleanup ordering to avoid use-after-free
Signed-off-by: Shelby Hagman <shelbyzh@amazon.com>
1 parent 5a30d3e commit a3c457f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

plugins/filter_kubernetes/kube_conf.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ void flb_kube_conf_destroy(struct flb_kube *ctx)
243243
if (ctx->kube_api_upstream) {
244244
flb_upstream_destroy(ctx->kube_api_upstream);
245245
}
246-
247-
if (ctx->aws_pod_association_tls) {
248-
flb_tls_destroy(ctx->aws_pod_association_tls);
249-
}
250-
251246
if (ctx->aws_pod_association_upstream) {
252247
flb_upstream_destroy(ctx->aws_pod_association_upstream);
253248
}
@@ -256,6 +251,10 @@ void flb_kube_conf_destroy(struct flb_kube *ctx)
256251
flb_free(ctx->platform);
257252
}
258253

254+
if (ctx->aws_pod_association_tls) {
255+
flb_tls_destroy(ctx->aws_pod_association_tls);
256+
}
257+
259258
#ifdef FLB_HAVE_TLS
260259
if (ctx->tls) {
261260
flb_tls_destroy(ctx->tls);

0 commit comments

Comments
 (0)