diff --git a/src/query/src/qast.c b/src/query/src/qast.c index ffd339f111b717de2d5f92aab140408994b316eb..03504a424420b08399bef0ddf54efac9e0f2312b 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -1062,10 +1062,9 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) { if (*e == TS_PATH_DELIMITER[0]) { cond = e + 1; } else if (*e == ',') { - size_t len = e - cond + VARSTR_HEADER_SIZE; - char* p = exception_malloc(len); - varDataSetLen(p, len - VARSTR_HEADER_SIZE); - memcpy(varDataVal(p), cond, len); + size_t len = e - cond; + char* p = exception_malloc(len + VARSTR_HEADER_SIZE); + STR_WITH_SIZE_TO_VARSTR(p, cond, len); cond += len; taosArrayPush(pVal->arr, &p); }