BugID:16760137:mqtt:destroy cur handle when Construct with custom params
@@ -3232,9 +3232,14 @@ void *IOT_MQTT_Construct(iotx_mqtt_param_t *pInitParams)
{
int err;
iotx_mc_client_t *pclient;
-
iotx_mqtt_param_t *mqtt_params = NULL;
- if (pInitParams == NULL) {
+
+ if (pInitParams != NULL) {
+ if (g_mqtt_client != NULL) {
+ IOT_MQTT_Destroy(&g_mqtt_client);
+ }
+
+ } else {
if (g_mqtt_client != NULL) {
return NULL;
}
