fix(query):fix query operator memory leak

This commit is contained in:
54liuyao 2024-09-02 13:46:21 +08:00
parent 645b264cad
commit 983962238e
3 changed files with 6 additions and 2 deletions

View File

@ -56,6 +56,7 @@ static int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTag
static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; } static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; }
static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; } static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; }
static void releaseColInfoData(void* pCol);
void initResultRowInfo(SResultRowInfo* pResultRowInfo) { void initResultRowInfo(SResultRowInfo* pResultRowInfo) {
pResultRowInfo->size = 0; pResultRowInfo->size = 0;
@ -531,7 +532,7 @@ static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarPara
int32_t code = colInfoDataEnsureCapacity(pColumnData, numOfRows, true); int32_t code = colInfoDataEnsureCapacity(pColumnData, numOfRows, true);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
terrno = code; terrno = code;
taosMemoryFree(pColumnData); releaseColInfoData(pColumnData);
return terrno; return terrno;
} }

View File

@ -1611,6 +1611,8 @@ int32_t getTableListInfo(const SExecTaskInfo* pTaskInfo, SArray** pList) {
int32_t code = extractTableList(pArray, pTaskInfo->pRoot); int32_t code = extractTableList(pArray, pTaskInfo->pRoot);
if (code == 0) { if (code == 0) {
*pList = pArray; *pList = pArray;
} else {
taosArrayDestroy(pArray);
} }
return code; return code;
} }

View File

@ -1105,7 +1105,8 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
SArray* pInfoList = NULL; SArray* pInfoList = NULL;
int32_t code = getTableListInfo(pTask, &pInfoList); int32_t code = getTableListInfo(pTask, &pInfoList);
if (code || pInfoList == NULL) { if (code != TSDB_CODE_SUCCESS || pInfoList == NULL) {
taosMemoryFree(pDeleterParam);
return code; return code;
} }