From d8570135179a1c237997dbad40100106b9ec6111 Mon Sep 17 00:00:00 2001 From: wpan Date: Fri, 25 Jun 2021 17:05:37 +0800 Subject: [PATCH] fix double free issue --- src/client/src/tscSQLParser.c | 7 ++++++- src/client/src/tscUtil.c | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e94f77d254..b388c21599 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7786,7 +7786,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf const char* msg5 = "only tag query not compatible with normal column filter"; const char* msg6 = "not support stddev/percentile in outer query yet"; const char* msg7 = "drivative requires timestamp column exists in subquery"; - + const char* msg8 = "condition missing for join query"; + int32_t code = TSDB_CODE_SUCCESS; SSqlCmd* pCmd = &pSql->cmd; @@ -7863,6 +7864,10 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf if (validateWhereNode(pQueryInfo, &pSqlNode->pWhere, pSql) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_OPERATION; } + } else { + if (pQueryInfo->numOfTables > 1) { + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg8); + } } // validate the interval info diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 74dbe42eeb..83be33ffef 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4077,7 +4077,10 @@ SVgroupsInfo* tscVgroupsInfoDup(SVgroupsInfo* pVgroupsInfo) { size_t size = sizeof(SVgroupInfo) * pVgroupsInfo->numOfVgroups + sizeof(SVgroupsInfo); SVgroupsInfo* pInfo = calloc(1, size); - memcpy(pInfo, pVgroupsInfo, size); + pInfo->numOfVgroups = pVgroupsInfo->numOfVgroups; + for (int32_t m = 0; m < pVgroupsInfo->numOfVgroups; ++m) { + tscSVgroupInfoCopy(&pInfo->vgroups[m], &pVgroupsInfo->vgroups[m]); + } return pInfo; } -- GitLab