From 06c2c82858ab32fd97ec85454575e3aa027b362d Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 18 Oct 2021 19:20:06 +0800 Subject: [PATCH] TD-6129 add taos json key hash free function --- src/tsdb/src/tsdbMeta.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 7e9eeb6ee8..ec45cdf1be 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -866,6 +866,7 @@ static STable *tsdbCreateTableFromCfg(STableCfg *pCfg, bool isSuper, STable *pST tsdbFreeTable(pTable); return NULL; } + taosHashSetFreeFp(pTable->jsonKeyMap, (_hash_free_fn_t)taosArrayDestroy); }else{ pTable->pIndex = tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, colType(pCol), (uint8_t)(colBytes(pCol)), NULL, SL_ALLOW_DUP_KEY, getTagIndexKey); @@ -925,21 +926,6 @@ _err: return NULL; } -static void* tsdbDestroyTagJsonHashTable(SHashObj* hashObj) { - if (hashObj == NULL) { - return NULL; - } - - SArray * p = taosHashIterate(hashObj, NULL); - while(p) { - taosArrayDestroy(p); - p = taosHashIterate(hashObj, p); - } - - taosHashCleanup(hashObj); - return NULL; -} - static void tsdbFreeTable(STable *pTable) { if (pTable) { if (pTable->name != NULL) @@ -957,7 +943,7 @@ static void tsdbFreeTable(STable *pTable) { kvRowFree(pTable->tagVal); tSkipListDestroy(pTable->pIndex); - tsdbDestroyTagJsonHashTable(pTable->jsonKeyMap); + taosHashCleanup(pTable->jsonKeyMap); taosTZfree(pTable->lastRow); tfree(pTable->sql); -- GitLab