diff --git a/src/rdkafka_cgrp.c b/src/rdkafka_cgrp.c index 5b023be65b..50d3ec24e1 100644 --- a/src/rdkafka_cgrp.c +++ b/src/rdkafka_cgrp.c @@ -370,8 +370,8 @@ void rd_kafka_cgrp_destroy_final(rd_kafka_cgrp_t *rkcg) { rd_list_destroy(&rkcg->rkcg_toppars); rd_list_destroy(rkcg->rkcg_subscribed_topics); rd_kafka_topic_partition_list_destroy(rkcg->rkcg_errored_topics); - if (rkcg->rkcg_assignor && rkcg->rkcg_assignor_state && - rkcg->rkcg_assignor->rkas_destroy_state_cb) + if (rkcg->rkcg_assignor && rkcg->rkcg_assignor->rkas_destroy_state_cb && + rkcg->rkcg_assignor_state) rkcg->rkcg_assignor->rkas_destroy_state_cb( rkcg->rkcg_assignor_state); rd_free(rkcg); @@ -1915,8 +1915,9 @@ static void rd_kafka_cgrp_handle_JoinGroup(rd_kafka_t *rk, "Unsupported assignment strategy \"%s\"", protocol_name); if (rkcg->rkcg_assignor) { - if (rkcg->rkcg_assignor_state && - rkcg->rkcg_assignor->rkas_destroy_state_cb) + if (rkcg->rkcg_assignor + ->rkas_destroy_state_cb && + rkcg->rkcg_assignor_state) rkcg->rkcg_assignor ->rkas_destroy_state_cb( rkcg->rkcg_assignor_state); @@ -1954,8 +1955,8 @@ static void rd_kafka_cgrp_handle_JoinGroup(rd_kafka_t *rk, } if (rkcg->rkcg_assignor && rkcg->rkcg_assignor != rkas) { - if (rkcg->rkcg_assignor_state && - rkcg->rkcg_assignor->rkas_destroy_state_cb) + if (rkcg->rkcg_assignor->rkas_destroy_state_cb && + rkcg->rkcg_assignor_state) rkcg->rkcg_assignor->rkas_destroy_state_cb( rkcg->rkcg_assignor_state); rkcg->rkcg_assignor_state = NULL;