diff --git a/src/client/src/tscParseLineProtocol.c b/src/client/src/tscParseLineProtocol.c index c2f0af962c65b3be0841dd0aa47d575c8263e56a..581ad1a03c0fd5856370bc7c011e0f13d6dbbb58 100644 --- a/src/client/src/tscParseLineProtocol.c +++ b/src/client/src/tscParseLineProtocol.c @@ -1781,12 +1781,28 @@ int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData) { //========================================================================= +void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { + for (int i=0; itagNum; ++i) { + free((point->tags+i)->key); + free((point->tags+i)->value); + } + free(point->tags); + for (int i=0; ifieldNum; ++i) { + free((point->fields+i)->key); + free((point->fields+i)->value); + } + free(point->fields); + free(point->stableName); + free(point->childTableName); +} + int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines) { for (int32_t i = 0; i < numLines; ++i) { TAOS_SML_DATA_POINT point = {0}; int32_t code = tscParseLine(lines[i], &point); if (code != TSDB_CODE_SUCCESS) { tscError("data point line parse failed. line %d : %s", i, lines[i]); + destroySmlDataPoint(&point); return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; } else { tscDebug("data point line parse success. line %d", i); @@ -1797,22 +1813,6 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile return 0; } - -void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) { - for (int i=0; itagNum; ++i) { - free((point->tags+i)->key); - free((point->tags+i)->value); - } - free(point->tags); - for (int i=0; ifieldNum; ++i) { - free((point->fields+i)->key); - free((point->fields+i)->value); - } - free(point->fields); - free(point->stableName); - free(point->childTableName); -} - int taos_insert_lines(TAOS* taos, char* lines[], int numLines) { int32_t code = 0; SArray* lpPoints = taosArrayInit(numLines, sizeof(TAOS_SML_DATA_POINT));