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];
|
||||
SSmlLineInfo *lines; // element is SSmlLineInfo
|
||||
bool parseJsonByLib;
|
||||
SArray *tagJsonArray;
|
||||
|
||||
//
|
||||
SArray *preLineTagKV;
|
||||
|
|
|
@ -1053,6 +1053,12 @@ void smlDestroyInfo(SSmlHandle *info) {
|
|||
// destroy 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->maxTagKVs);
|
||||
taosArrayDestroy(info->preLineColKV);
|
||||
|
@ -1091,6 +1097,7 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
|
|||
info->pQuery = smlInitHandle();
|
||||
info->dataFormat = true;
|
||||
|
||||
info->tagJsonArray = taosArrayInit(8, POINTER_BYTES);
|
||||
info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv));
|
||||
info->maxTagKVs = 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;
|
||||
}
|
||||
|
||||
taosArrayPush(info->tagJsonArray, &tagsJson);
|
||||
ret = smlParseTagsFromJSON(info, tagsJson, elements);
|
||||
cJSON_free(tagsJson);
|
||||
if (unlikely(ret)) {
|
||||
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue