Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion plugins/out_kafka/kafka_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct flb_out_kafka *flb_out_kafka_create(struct flb_output_instance *ins,
}
ctx->ins = ins;
ctx->blocked = FLB_FALSE;
mk_list_init(&ctx->topics);

ret = flb_output_config_map_set(ins, (void*) ctx);
if (ret == -1) {
Expand Down Expand Up @@ -239,9 +240,13 @@ struct flb_out_kafka *flb_out_kafka_create(struct flb_output_instance *ins,
if (!ctx->kafka.rk) {
flb_plg_error(ctx->ins, "failed to create producer: %s",
errstr);
rd_kafka_conf_destroy(ctx->conf);
ctx->conf = NULL;
flb_out_kafka_destroy(ctx);
return NULL;
}
/* rd_kafka_new() succeeded, conf ownership transferred to rk */
ctx->conf = NULL;

#ifdef FLB_HAVE_AVRO_ENCODER
/* Config AVRO */
Expand All @@ -256,7 +261,6 @@ struct flb_out_kafka *flb_out_kafka_create(struct flb_output_instance *ins,
#endif

/* Config: Topic */
mk_list_init(&ctx->topics);
tmp = flb_output_get_property("topics", ins);
if (!tmp) {
flb_kafka_topic_create(FLB_KAFKA_TOPIC, ctx);
Expand Down Expand Up @@ -304,6 +308,10 @@ int flb_out_kafka_destroy(struct flb_out_kafka *ctx)
rd_kafka_destroy(ctx->kafka.rk);
}

if (ctx->conf) {
rd_kafka_conf_destroy(ctx->conf);
}

if (ctx->opaque) {
flb_kafka_opaque_destroy(ctx->opaque);
}
Expand Down
Loading