fix:memory leak
This commit is contained in:
parent
e7e4d84627
commit
d3fe415bef
|
@ -182,6 +182,7 @@ typedef struct {
|
||||||
int8_t offset[OTD_JSON_FIELDS_NUM];
|
int8_t offset[OTD_JSON_FIELDS_NUM];
|
||||||
SSmlLineInfo *lines; // element is SSmlLineInfo
|
SSmlLineInfo *lines; // element is SSmlLineInfo
|
||||||
bool parseJsonByLib;
|
bool parseJsonByLib;
|
||||||
|
SArray *tagJsonArray;
|
||||||
|
|
||||||
//
|
//
|
||||||
SArray *preLineTagKV;
|
SArray *preLineTagKV;
|
||||||
|
|
|
@ -1053,6 +1053,12 @@ void smlDestroyInfo(SSmlHandle *info) {
|
||||||
// destroy info->pVgHash
|
// destroy info->pVgHash
|
||||||
taosHashCleanup(info->pVgHash);
|
taosHashCleanup(info->pVgHash);
|
||||||
|
|
||||||
|
for(int i = 0; i< taosArrayGetSize(info->tagJsonArray); i++){
|
||||||
|
cJSON *tags = (cJSON *)taosArrayGetP(info->tagJsonArray, i);
|
||||||
|
cJSON_Delete(tags);
|
||||||
|
}
|
||||||
|
taosArrayDestroy(info->tagJsonArray);
|
||||||
|
|
||||||
taosArrayDestroy(info->preLineTagKV);
|
taosArrayDestroy(info->preLineTagKV);
|
||||||
taosArrayDestroy(info->maxTagKVs);
|
taosArrayDestroy(info->maxTagKVs);
|
||||||
taosArrayDestroy(info->preLineColKV);
|
taosArrayDestroy(info->preLineColKV);
|
||||||
|
@ -1091,6 +1097,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
|
||||||
info->pQuery = smlInitHandle();
|
info->pQuery = smlInitHandle();
|
||||||
info->dataFormat = true;
|
info->dataFormat = true;
|
||||||
|
|
||||||
|
info->tagJsonArray = taosArrayInit(8, POINTER_BYTES);
|
||||||
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv));
|
info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv));
|
info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||||
|
|
|
@ -1118,8 +1118,8 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
|
||||||
return TSDB_CODE_TSC_INVALID_JSON;
|
return TSDB_CODE_TSC_INVALID_JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosArrayPush(info->tagJsonArray, &tagsJson);
|
||||||
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
||||||
cJSON_free(tagsJson);
|
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
|
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue