From 9363f414d65c140c2597d0d4115edf150104a2eb Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 12 Dec 2020 18:37:48 +0800 Subject: [PATCH] [TD-225] release the ref if insertion succeeds. --- src/client/src/tscUtil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 416e7c2dae..b7fe6aa7b2 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -405,8 +405,12 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd, bool removeFromCache) { pCmd->msgType = 0; pCmd->parseFinished = 0; pCmd->autoCreated = 0; - pCmd->numOfTables = 0; + for(int32_t i = 0; i < pCmd->numOfTables; ++i) { + taosCacheRelease(tscMetaCache, (void**)&(pCmd->pTableMetaList[i]), false); + } + + pCmd->numOfTables = 0; tfree(pCmd->pTableMetaList); pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList);