From bd386044a14ed7d7ebcdf2957d7670ac83509f4e Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 7 Jan 2022 13:50:06 +0800 Subject: [PATCH] [td-11818] fix invalid free. --- source/client/src/clientImpl.c | 2 +- source/libs/catalog/src/catalog.c | 6 ++---- source/libs/parser/inc/astGenerator.h | 2 +- source/libs/parser/src/astGenerator.c | 2 +- source/libs/parser/src/dCDAstProcess.c | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 9673937811..3205524e3c 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -181,7 +181,7 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) { if (pDcl->msgType == TDMT_VND_SHOW_TABLES) { SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo; if (pShowReqInfo->pArray == NULL) { - pShowReqInfo->currentIndex = 0; + pShowReqInfo->currentIndex = 0; // set the first vnode/ then iterate the next vnode pShowReqInfo->pArray = pDcl->pExtension; } } diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 79c8e4ea63..d4caf730b4 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -568,18 +568,17 @@ int32_t catalogGetDBVgroup(struct SCatalog* pCatalog, void *pRpc, const SEpSet* CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); } - SDBVgroupInfo* db = NULL; + SDBVgroupInfo* db = NULL; SVgroupInfo *vgInfo = NULL; int32_t code = 0; SArray *vgList = NULL; - CTG_ERR_JRET(ctgGetDBVgroup(pCatalog, pRpc, pMgmtEps, dbName, forceUpdate, &db)); vgList = taosArrayInit(taosHashGetSize(db->vgInfo), sizeof(SVgroupInfo)); if (NULL == vgList) { ctgError("taosArrayInit failed"); - CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); + CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); } void *pIter = taosHashIterate(db->vgInfo, NULL); @@ -599,7 +598,6 @@ int32_t catalogGetDBVgroup(struct SCatalog* pCatalog, void *pRpc, const SEpSet* vgList = NULL; _return: - if (db) { CTG_UNLOCK(CTG_READ, &db->lock); taosHashRelease(pCatalog->dbCache.cache, db); diff --git a/source/libs/parser/inc/astGenerator.h b/source/libs/parser/inc/astGenerator.h index 22806969af..7f357a2bbd 100644 --- a/source/libs/parser/inc/astGenerator.h +++ b/source/libs/parser/inc/astGenerator.h @@ -123,7 +123,7 @@ typedef struct SCreatedTableInfo { SToken name; // table name token SToken stbName; // super table name token , for using clause SArray *pTagNames; // create by using super table, tag name - SArray *pTagVals; // create by using super table, tag value + SArray *pTagVals; // create by using super table, tag value. SArray char *fullname; // table full name int8_t igExist; // ignore if exists } SCreatedTableInfo; diff --git a/source/libs/parser/src/astGenerator.c b/source/libs/parser/src/astGenerator.c index 0cb3cea95f..34ed8bd355 100644 --- a/source/libs/parser/src/astGenerator.c +++ b/source/libs/parser/src/astGenerator.c @@ -686,7 +686,7 @@ void destroySqlNode(SSqlNode *pSqlNode) { void freeCreateTableInfo(void* p) { SCreatedTableInfo* pInfo = (SCreatedTableInfo*) p; taosArrayDestroy(pInfo->pTagNames); - taosArrayDestroyEx(pInfo->pTagVals, freeItem); + taosArrayDestroy(pInfo->pTagVals); tfree(pInfo->fullname); } diff --git a/source/libs/parser/src/dCDAstProcess.c b/source/libs/parser/src/dCDAstProcess.c index abee162255..60f4d4835b 100644 --- a/source/libs/parser/src/dCDAstProcess.c +++ b/source/libs/parser/src/dCDAstProcess.c @@ -332,7 +332,6 @@ static int32_t doParseSerializeTagValue(SSchema* pTagSchema, int32_t numOfInputT char* endPtr = NULL; char tmpTokenBuf[TSDB_MAX_TAGS_LEN] = {0}; - SKvParam param = {.builder = pKvRowBuilder, .schema = pSchema}; SToken* pItem = taosArrayGet(pTagValList, i);