From 0160741ab0ecbe553a84ab27f772a0752e6f27f0 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Thu, 10 Oct 2024 14:04:09 -0600 Subject: [PATCH] out_opentelemetry: fix check for uri sanitization when exiting Signed-off-by: Eduardo Silva --- plugins/out_opentelemetry/opentelemetry.c | 2 +- plugins/out_opentelemetry/opentelemetry_conf.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/out_opentelemetry/opentelemetry.c b/plugins/out_opentelemetry/opentelemetry.c index cc5680ba3b2..8471c8102f6 100644 --- a/plugins/out_opentelemetry/opentelemetry.c +++ b/plugins/out_opentelemetry/opentelemetry.c @@ -312,7 +312,7 @@ static int process_metrics(struct flb_event_chunk *event_chunk, diff = off; /* concat buffer */ - flb_sds_cat_safe(&buf, encoded_chunk, flb_sds_len(encoded_chunk)); + flb_sds_cat_safe(&buf, encoded_chunk, cfl_sds_len(encoded_chunk)); /* release */ cmt_encode_opentelemetry_destroy(encoded_chunk); diff --git a/plugins/out_opentelemetry/opentelemetry_conf.c b/plugins/out_opentelemetry/opentelemetry_conf.c index 80a193d37b5..f6c8b40ba9c 100644 --- a/plugins/out_opentelemetry/opentelemetry_conf.c +++ b/plugins/out_opentelemetry/opentelemetry_conf.c @@ -555,15 +555,15 @@ void flb_opentelemetry_context_destroy(struct opentelemetry_context *ctx) flb_upstream_destroy(ctx->u); } - if (ctx->logs_uri_sanitized != NULL) { + if (ctx->logs_uri_sanitized != NULL && ctx->logs_uri_sanitized != ctx->logs_uri) { flb_free(ctx->logs_uri_sanitized); } - if (ctx->traces_uri_sanitized != NULL) { + if (ctx->traces_uri_sanitized != NULL && ctx->traces_uri_sanitized != ctx->traces_uri) { flb_free(ctx->traces_uri_sanitized); } - if (ctx->metrics_uri_sanitized != NULL) { + if (ctx->metrics_uri_sanitized != NULL && ctx->metrics_uri_sanitized != ctx->metrics_uri) { flb_free(ctx->metrics_uri_sanitized); }