Skip to content

Commit

Permalink
Avoid use of partially destroyed topic object (#1125)
Browse files Browse the repository at this point in the history
Identified and fixed by @benli123

#Changelog
  • Loading branch information
edenhill committed Mar 17, 2017
1 parent ee511d4 commit 94124ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/rdkafka_topic.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ void rd_kafka_topic_destroy_final (rd_kafka_itopic_t *rkt) {

rd_kafka_assert(rkt->rkt_rk, rd_refcnt_get(&rkt->rkt_refcnt) == 0);

if (rkt->rkt_topic)
rd_kafkap_str_destroy(rkt->rkt_topic);
rd_kafka_wrlock(rkt->rkt_rk);
TAILQ_REMOVE(&rkt->rkt_rk->rk_topics, rkt, rkt_link);
rkt->rkt_rk->rk_topic_cnt--;
rd_kafka_wrunlock(rkt->rkt_rk);

rd_kafka_assert(rkt->rkt_rk, rd_list_empty(&rkt->rkt_desp));
rd_list_destroy(&rkt->rkt_desp);

rd_kafka_wrlock(rkt->rkt_rk);
TAILQ_REMOVE(&rkt->rkt_rk->rk_topics, rkt, rkt_link);
rkt->rkt_rk->rk_topic_cnt--;
rd_kafka_wrunlock(rkt->rkt_rk);
if (rkt->rkt_topic)
rd_kafkap_str_destroy(rkt->rkt_topic);

rd_kafka_anyconf_destroy(_RK_TOPIC, &rkt->rkt_conf);

Expand Down

0 comments on commit 94124ea

Please sign in to comment.