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); }