From 2afa91dbc25ce035749ea33e73393c1e363313f4 Mon Sep 17 00:00:00 2001 From: Rangaiah <107978226+nlrcomcast@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:40:02 +0530 Subject: [PATCH] Revert "Review comment changes for client id get" --- src/mqttcm_connect.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/mqttcm_connect.c b/src/mqttcm_connect.c index 4fcddaa..a96f364 100644 --- a/src/mqttcm_connect.c +++ b/src/mqttcm_connect.c @@ -1694,7 +1694,7 @@ int printList() int mqtt_subscribe(char *comp, char *topic) { int rc; - char temp_topic[30]={'\0'}; + char temp_topic[30]; if(topic != NULL && comp !=NULL) { int ret = isSubscribeNeeded(comp); @@ -1718,18 +1718,9 @@ int mqtt_subscribe(char *comp, char *topic) if(strcmp (comp, SUBSCRIBE_WEBCONFIG) == 0) { int subscribeId; - char *tempclient_id = NULL; - tempclient_id = Get_Mqtt_ClientId(); - if( tempclient_id != NULL && strlen(tempclient_id) !=0 ) + if( Get_Mqtt_ClientId() != NULL) { - snprintf(temp_topic, sizeof(temp_topic), "%s%s/#", MQTT_SUBSCRIBE_TOPIC, tempclient_id); - MQTTCM_FREE(tempclient_id); - tempclient_id = NULL; - } - else - { - MqttCMError("Client id is NULL so not proceeding to subscribe\n"); - return 1; + snprintf(temp_topic, sizeof(temp_topic), "%s%s/#", MQTT_SUBSCRIBE_TOPIC, Get_Mqtt_ClientId()); } MqttCMInfo("Subscribing to wildcard topic - %s\n", temp_topic); rc = mosquitto_subscribe(mosq, &subscribeId, temp_topic, 1);