kafka: use rd_kafka_conf_destroy in flb_kafka_conf_create error path#11859
kafka: use rd_kafka_conf_destroy in flb_kafka_conf_create error path#11859immanuwell wants to merge 1 commit into
Conversation
The error path in flb_kafka_conf_create called flb_free() on a rd_kafka_conf_t pointer returned by rd_kafka_conf_new(). This only frees the top-level struct and skips rd_kafka_anyconf_destroy(), leaking all internally allocated strings (default config values, client.id, group.id, etc.). Replace with rd_kafka_conf_destroy(), which is what every other caller in the codebase already uses to clean up kafka conf objects. Signed-off-by: Immanuel Tikhonov <pchpr.00@list.ru> Signed-off-by: immanuwell <pchpr.00@list.ru>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single-line fix in the error cleanup path of Changesrdkafka Config Cleanup
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
flb_kafka_conf_createleaks memory when it hits the error path (e.g. missingbrokersconfig). code callsflb_free(kafka_cfg)on therd_kafka_conf_t*fromrd_kafka_conf_new(), which skipsrd_kafka_anyconf_destroy()and leaves all internal strings (default props, client.id, group.id) hanging in memory.one-line fix: swap
flb_freeforrd_kafka_conf_destroy. every other caller in the codebase already does this (in_kafka.c:459,out_kafka/kafka_config.c:255,320).How to repro: configure a kafka output without brokers and run under valgrind:
valgrind will show leaks from rd_kafka_conf_set allocations that never get freed on teardown.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit