From 1f1ea15c61d105b09fda613f3ae9283d2b9fcaa5 Mon Sep 17 00:00:00 2001 From: difrin Date: Sat, 16 Mar 2024 10:54:07 +0100 Subject: [PATCH] [FIX] track memory leak Signed-off-by: difrin --- plugins/out_kafka/kafka.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/out_kafka/kafka.c b/plugins/out_kafka/kafka.c index c860df67ad4..6a26c4876cb 100644 --- a/plugins/out_kafka/kafka.c +++ b/plugins/out_kafka/kafka.c @@ -230,13 +230,15 @@ int produce_message(struct flb_time *tm, msgpack_object *map, flb_warn("Field '%s' not found or not a string value", field_name); } - flb_free(field_name); // Free allocated memory - } + + } else { /* Static header value */ rd_kafka_header_add(kafka_headers, hkey->str, flb_sds_len(hkey->str), hval->str, flb_sds_len(hval->str)); - } + } + + flb_free(field_name); // Free allocated memory } } else {