diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 738ebd07dc..d0db130bf3 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -122,6 +122,7 @@ SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint uint32_t offset); void* tscDestroyBlockArrayList(SArray* pDataBlockList); +void* tscDestroyUdfArrayList(SArray* pUdfList); void* tscDestroyBlockHashTable(SHashObj* pBlockHashTable, bool removeMeta); int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 8d320c9a83..0f5e607e22 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -435,6 +435,7 @@ void tscResetSqlCmd(SSqlCmd* pCmd, bool removeMeta) { pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList, removeMeta); pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks); + pCmd->pUdfInfo = tscDestroyUdfArrayList(pCmd->pUdfInfo); tscFreeQueryInfo(pCmd, removeMeta); } @@ -610,6 +611,26 @@ void* tscDestroyBlockArrayList(SArray* pDataBlockList) { return NULL; } +void* tscDestroyUdfArrayList(SArray* pUdfList) { + if (pUdfList == NULL) { + return NULL; + } + + size_t size = taosArrayGetSize(pUdfList); + for (int32_t i = 0; i < size; i++) { + SUdfInfo* udf = taosArrayGet(pUdfList, i); + if (udf) { + tfree(udf->content); + tfree(udf->name); + } + } + + taosArrayDestroy(pUdfList); + return NULL; +} + + + void* tscDestroyBlockHashTable(SHashObj* pBlockHashTable, bool removeMeta) { if (pBlockHashTable == NULL) { return NULL;