Skip to content

Commit 360f6bb

Browse files
author
fancyxu
committed
修复当内存不足时,申请shadow资源没释放的问题
1 parent 11774e8 commit 360f6bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sdk_src/services/shadow/shadow_client.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ void* IOT_Shadow_Construct(ShadowInitParams *pParams)
131131
Qcloud_IoT_Shadow *shadow_client = NULL;
132132
if ((shadow_client = (Qcloud_IoT_Shadow *)HAL_Malloc(sizeof(Qcloud_IoT_Shadow))) == NULL) {
133133
Log_e("memory not enough to malloc ShadowClient");
134+
return NULL;
134135
}
135136

136137
MQTTInitParams mqtt_init_params;
@@ -155,7 +156,7 @@ void* IOT_Shadow_Construct(ShadowInitParams *pParams)
155156

156157
rc = qcloud_iot_shadow_init(shadow_client);
157158
if (rc != QCLOUD_RET_SUCCESS) {
158-
IOT_MQTT_Destroy(&(shadow_client->mqtt));
159+
IOT_Shadow_Destroy(shadow_client);
159160
HAL_Free(shadow_client);
160161
goto End;
161162
}

0 commit comments

Comments
 (0)