diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 9be79a539f468d20ad28d2278651fbae169ff4a6..e6240f64b5709cd04391084411da2ef7a7696c61 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -90,6 +90,7 @@ int32_t qCloneStmtDataBlock(void** pDst, void* pSrc); void qFreeStmtDataBlock(void* pDataBlock); int32_t qRebuildStmtDataBlock(void** pDst, void* pSrc, uint64_t uid, int32_t vgId); void qDestroyStmtDataBlock(void* pBlock); +void qDestroyStmtDataBlockExt(void* pBlock); STableMeta* qGetTableMetaInDataBlock(void* pDataBlock); int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx); @@ -108,7 +109,8 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* void* smlInitHandle(SQuery* pQuery); void smlDestroyHandle(void* pHandle); int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta, - char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, int16_t msgBufLen); + char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl, char* msgBuf, + int16_t msgBufLen); int32_t smlBuildOutput(void* handle, SHashObj* pVgHash); int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray); diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index c040d389cd573660149da052f619981778d46f66..8a677d7a5e910602ffefcf8761e78c41619fcf30 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -301,11 +301,7 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) { continue; } - if (pBlocks->cloned) { - qFreeStmtDataBlock(pBlocks); - } else { - qDestroyStmtDataBlock(pBlocks); - } + qDestroyStmtDataBlockExt(pBlocks); taosHashRemove(pStmt->exec.pBlockHash, key, keyLen); pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 2466e784c1f1e73383b53c9f6af3328d3e23f119..8a23cd32b40a520d5780ca0c2681ca0a0e8afc20 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -476,3 +476,16 @@ void qDestroyStmtDataBlock(void* pBlock) { pDataBlock->cloned = false; insDestroyDataBlock(pDataBlock); } + +void qDestroyStmtDataBlockExt(void* pBlock) { + if (pBlock == NULL) { + return; + } + + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + if (pDataBlock->cloned) { + qFreeStmtDataBlock(pBlock); + } else { + qDestroyStmtDataBlock(pBlock); + } +}