From 1d2297849f4a170973ed477ad36ac030573bba9e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 1 Apr 2024 20:53:24 +0800 Subject: [PATCH] out_kafka: Fix invalid free of the message_key The value is owned by the properties of the output and we don't need to free this. ==57818== Invalid free() / delete / delete[] / realloc() ==57818== at 0x4887B40: free (vg_replace_malloc.c:872) ==57818== by 0x8EE5F3: flb_free (flb_mem.h:127) ==57818== by 0x8F27A7: flb_out_kafka_destroy (kafka_config.c:243) ==57818== by 0x8EE3F7: cb_kafka_exit (kafka.c:558) ==57818== by 0x4D6D5B: flb_output_exit (flb_output.c:474) ==57818== by 0x4FF65F: flb_engine_shutdown (flb_engine.c:1119) ==57818== by 0x4FF333: flb_engine_start (flb_engine.c:1017) ==57818== by 0x49F20B: flb_lib_worker (flb_lib.c:674) ==57818== by 0x4F1EE57: start_thread (pthread_create.c:442) ==57818== by 0x4F87F9B: thread_start (clone.S:79) ==57818== Address 0x5d22850 is 16 bytes inside a block of size 24 alloc'd ==57818== at 0x48850C8: malloc (vg_replace_malloc.c:381) ==57818== by 0x4AD267: flb_malloc (flb_mem.h:80) ==57818== by 0x4AD4C3: sds_alloc (flb_sds.c:41) ==57818== by 0x4AD60F: flb_sds_create_size (flb_sds.c:93) ==57818== by 0x5B0D3F: flb_env_var_translate (flb_env.c:180) ==57818== by 0x4D76BF: flb_output_set_property (flb_output.c:753) ==57818== by 0x4E869F: configure_plugins_type (flb_config.c:833) ==57818== by 0x4E8BFF: flb_config_load_config_format (flb_config.c:941) ==57818== by 0x489843: service_configure (fluent-bit.c:765) ==57818== by 0x48A95B: flb_main (fluent-bit.c:1298) ==57818== by 0x48AD47: main (fluent-bit.c:1456) Signed-off-by: Holger Hans Peter Freyther --- plugins/out_kafka/kafka_config.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/out_kafka/kafka_config.c b/plugins/out_kafka/kafka_config.c index fb2f5ca146c..0caea60d06d 100644 --- a/plugins/out_kafka/kafka_config.c +++ b/plugins/out_kafka/kafka_config.c @@ -239,10 +239,6 @@ int flb_out_kafka_destroy(struct flb_out_kafka *ctx) flb_free(ctx->topic_key); } - if (ctx->message_key) { - flb_free(ctx->message_key); - } - if (ctx->message_key_field) { flb_free(ctx->message_key_field); }