提交 a7aa9ac4 编写于 作者: wmmhello's avatar wmmhello

fix:reset measuretag pointer if it is the same child table

上级 fba34210
......@@ -1082,7 +1082,8 @@ void smlDestroyInfo(SSmlHandle *info) {
if (info->parseJsonByLib) {
taosMemoryFree(info->lines[i].tags);
}
taosMemoryFree(info->lines[i].measureTag);
if(info->lines[i].measureTagsLen != 0)
taosMemoryFree(info->lines[i].measureTag);
}
taosMemoryFree(info->lines);
}
......
......@@ -812,6 +812,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
elements->measureTag = (char*)taosMemoryMalloc(elements->measureLen + elements->tagsLen);
memcpy(elements->measureTag, elements->measure, elements->measureLen);
memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen);
elements->measureTagsLen = elements->measureLen + elements->tagsLen;
SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen);
SSmlTableInfo *tinfo = NULL;
......@@ -1018,6 +1019,8 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo
elements->tags = NULL;
return ret;
}
}else{
elements->measureTag = info->preLine.measureTag;
}
if(needFree){
......@@ -1196,6 +1199,8 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id);
return ret;
}
}else{
elements->measureTag = info->preLine.measureTag;
}
if(unlikely(info->reRun)){
......
......@@ -71,6 +71,7 @@ static void smlParseTelnetElement(char **sql, char *sqlEnd, char **data, int32_t
static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SSmlLineInfo *elements, SSmlMsgBuf *msg) {
if(is_same_child_table_telnet(elements, &info->preLine) == 0){
elements->measureTag = info->preLine.measureTag;
return TSDB_CODE_SUCCESS;
}
......@@ -234,6 +235,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
elements->measureTag = (char*)taosMemoryMalloc(elements->measureLen + elements->tagsLen);
memcpy(elements->measureTag, elements->measure, elements->measureLen);
memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen);
elements->measureTagsLen = elements->measureLen + elements->tagsLen;
SSmlTableInfo **tmp = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureLen + elements->tagsLen);
SSmlTableInfo *tinfo = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册