解决cJSON内存泄露的问题

Signed-off-by: y500286920 <yangliu158@huawei.com>
This commit is contained in:
y500286920 2022-08-03 10:24:34 +08:00
parent 057807ee4b
commit 0cfb35e143

View File

@ -97,8 +97,10 @@ int32_t TransAuthChannelErrorPack(int32_t errcode, const char *errMsg, char *cJs
}
if (memcpy_s(cJsonStr, ERR_MSG_MAX_LEN, data, strlen(data)) != EOK) {
cJSON_Delete(obj);
cJSON_free(data);
return SOFTBUS_MEM_ERR;
}
cJSON_Delete(obj);
cJSON_free(data);
return SOFTBUS_OK;
}