From 490466747184737a44688eec38db16fd0b004020 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 15 Oct 2024 15:19:37 +0800 Subject: [PATCH] fix:[TS-5528] insert error in sml --- source/client/src/clientSml.c | 5 ++--- source/client/src/clientSmlLine.c | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 80f583bbee..46aaf29b6b 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -262,7 +262,7 @@ int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSml return TSDB_CODE_SUCCESS; } -bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { +void isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { // cnt begin 0, add ts so + 2 if (unlikely(cnt + 2 > info->currSTableMeta->tableInfo.numOfColumns)) { goto END; @@ -288,12 +288,11 @@ bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { maxKV->length = kv->length; info->needModifySchema = true; } - return true; + return; END: info->dataFormat = false; info->reRun = true; - return false; } bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index fabda47ae1..c1f3431698 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -452,7 +452,10 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if (info->dataFormat) { bool isAligned = isSmlColAligned(info, cnt, &kv); if (kv.type == TSDB_DATA_TYPE_BINARY && valueEscaped) { - taosArrayPush(info->escapedStringList, &kv.value); + if (taosArrayPush(info->escapedStringList, &kv.value) == NULL){ + freeSSmlKv(&kv); + return terrno; + } kv.value = NULL; } freeSSmlKv(&kv); @@ -463,10 +466,12 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if (currElement->colArray == NULL) { currElement->colArray = taosArrayInit_s(sizeof(SSmlKv), 1); if (currElement->colArray == NULL) { + freeSSmlKv(&kv); return terrno; } } if (taosArrayPush(currElement->colArray, &kv) == NULL){ // reserve for timestamp + freeSSmlKv(&kv); return terrno; } }