diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b9e13865f8ea0d4aaf143c4e47fde8ec69e9855e..4065526f1cfb291ba4b849ecd535c0b6f54b5cb5 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -8195,7 +8195,10 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) { size_t len = strlen(name); - taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&pTableMeta, &tableMetaCapacity); + if (NULL == taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&pTableMeta, &tableMetaCapacity)){ + tfree(pTableMeta); + tableMetaCapacity = 0; + } if (pTableMeta && pTableMeta->id.uid > 0) { tscDebug("0x%"PRIx64" retrieve table meta %s from local buf", pSql->self, name); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 97b7fb0a5abbbb2eca0e46d2a07d39e85d5d5e6a..4dd252b692abcf62ad210a88c86f94a689caa84b 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2997,7 +2997,10 @@ int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool memset(pTableMetaInfo->pTableMeta, 0, pTableMetaInfo->tableMetaCapacity); } } - taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&(pTableMetaInfo->pTableMeta), &pTableMetaInfo->tableMetaCapacity); + if (NULL == taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&(pTableMetaInfo->pTableMeta), &pTableMetaInfo->tableMetaCapacity)) { + tfree(pTableMetaInfo->pTableMeta); + pTableMetaInfo->tableMetaCapacity = 0; + } STableMeta* pMeta = pTableMetaInfo->pTableMeta; if (pMeta && pMeta->id.uid > 0) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index e5c6392d4d8b99416f191b1f189765f42a9a0c79..002a368f792bd91b5c3a96760a497177a155c194 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -4418,7 +4418,9 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name, STableMeta* pChild = *ppChild; STableMeta* pChild1; - taosHashGetCloneExt(tscTableMetaMap, pChild->sTableName, strnlen(pChild->sTableName, TSDB_TABLE_FNAME_LEN), NULL, (void **)&p, &sz); + if(NULL == taosHashGetCloneExt(tscTableMetaMap, pChild->sTableName, strnlen(pChild->sTableName, TSDB_TABLE_FNAME_LEN), NULL, (void **)&p, &sz)) { + tfree(p); + } // tableMeta exists, build child table meta according to the super table meta // the uid need to be checked in addition to the general name of the super table.