From 0e751a15835249f51872ebf6d49edac957a28dc5 Mon Sep 17 00:00:00 2001 From: Takahiro Yamashita Date: Fri, 3 Nov 2023 17:17:03 +0900 Subject: [PATCH] in_splunk: ensure releasing tag_from_record Signed-off-by: Takahiro Yamashita --- plugins/in_splunk/splunk_prot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/in_splunk/splunk_prot.c b/plugins/in_splunk/splunk_prot.c index 5b0606083da..5576b544d25 100644 --- a/plugins/in_splunk/splunk_prot.c +++ b/plugins/in_splunk/splunk_prot.c @@ -292,8 +292,6 @@ static void process_flb_log_append(struct flb_splunk *ctx, msgpack_object *recor flb_sds_len(tag_from_record), ctx->log_encoder.output_buffer, ctx->log_encoder.output_length); - - flb_sds_destroy(tag_from_record); } else if (tag) { flb_input_log_append(ctx->ins, tag, flb_sds_len(tag), @@ -310,6 +308,10 @@ static void process_flb_log_append(struct flb_splunk *ctx, msgpack_object *recor else { flb_plg_error(ctx->ins, "Error encoding record : %d", ret); } + + if (tag_from_record) { + flb_sds_destroy(tag_from_record); + } } static int process_json_payload_pack(struct flb_splunk *ctx, flb_sds_t tag, char *buf, size_t size)