From f14c45f68b57fffe8cc11bb544f17320de916387 Mon Sep 17 00:00:00 2001 From: Michael Filonenko Date: Wed, 20 Jan 2021 13:35:43 +0300 Subject: [PATCH 1/2] Update consumer_msg.c --- kafka/consumer_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kafka/consumer_msg.c b/kafka/consumer_msg.c index 6e3216c..6ca03d9 100644 --- a/kafka/consumer_msg.c +++ b/kafka/consumer_msg.c @@ -122,6 +122,8 @@ new_consumer_msg(rd_kafka_message_t *rd_message) { msg = malloc(sizeof(msg_t)); msg->topic = rd_message->rkt; msg->partition = rd_message->partition; + msg->value = NULL; + msg->key = NULL; // value if (rd_message->len > 0) { @@ -159,4 +161,4 @@ destroy_consumer_msg(msg_t *msg) { free(msg); return; -} \ No newline at end of file +} From 339095c462fa03d4066c370520f972dc09f44691 Mon Sep 17 00:00:00 2001 From: Michael Filonenko Date: Thu, 21 Jan 2021 15:38:21 +0300 Subject: [PATCH 2/2] Make consumer msg init with zeros --- kafka/consumer_msg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kafka/consumer_msg.c b/kafka/consumer_msg.c index 6ca03d9..be5dc41 100644 --- a/kafka/consumer_msg.c +++ b/kafka/consumer_msg.c @@ -123,7 +123,10 @@ new_consumer_msg(rd_kafka_message_t *rd_message) { msg->topic = rd_message->rkt; msg->partition = rd_message->partition; msg->value = NULL; + msg->value_len = 0; msg->key = NULL; + msg->key_len = 0; + msg->offset = 0; // value if (rd_message->len > 0) {