fix(query): fix some memory leak.

This commit is contained in:
Haojun Liao 2022-07-19 16:34:26 +08:00
parent cd2eaf0152
commit 79b0240a87
1 changed files with 13 additions and 10 deletions

View File

@ -110,23 +110,24 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
return NULL; return NULL;
} }
struct SSubplan* plan = NULL; struct SSubplan* pPlan = NULL;
int32_t code = qStringToSubplan(msg, &plan); int32_t code = qStringToSubplan(msg, &pPlan);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
terrno = code; terrno = code;
return NULL; return NULL;
} }
qTaskInfo_t pTaskInfo = NULL; qTaskInfo_t pTaskInfo = NULL;
code = qCreateExecTask(readers, 0, 0, plan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_QUEUE); code = qCreateExecTask(readers, 0, 0, pPlan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_QUEUE);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
// TODO: destroy SSubplan & pTaskInfo nodesDestroyNode((SNode*)pPlan);
qDestroyTask(pTaskInfo);
terrno = code; terrno = code;
return NULL; return NULL;
} }
// extract the number of output columns // extract the number of output columns
SDataBlockDescNode* pDescNode = plan->pNode->pOutputDataBlockDesc; SDataBlockDescNode* pDescNode = pPlan->pNode->pOutputDataBlockDesc;
*numOfCols = 0; *numOfCols = 0;
SNode* pNode; SNode* pNode;
@ -137,7 +138,7 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
} }
} }
nodesDestroyNode((SNode*)pPlan);
return pTaskInfo; return pTaskInfo;
} }
@ -148,21 +149,23 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers) {
/*qDebugL("stream task string %s", (const char*)msg);*/ /*qDebugL("stream task string %s", (const char*)msg);*/
struct SSubplan* plan = NULL; struct SSubplan* pPlan = NULL;
int32_t code = qStringToSubplan(msg, &plan); int32_t code = qStringToSubplan(msg, &pPlan);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
terrno = code; terrno = code;
return NULL; return NULL;
} }
qTaskInfo_t pTaskInfo = NULL; qTaskInfo_t pTaskInfo = NULL;
code = qCreateExecTask(readers, 0, 0, plan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_STREAM); code = qCreateExecTask(readers, 0, 0, pPlan, &pTaskInfo, NULL, NULL, OPTR_EXEC_MODEL_STREAM);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
// TODO: destroy SSubplan & pTaskInfo nodesDestroyNode((SNode*)pPlan);
qDestroyTask(pTaskInfo);
terrno = code; terrno = code;
return NULL; return NULL;
} }
nodesDestroyNode((SNode*)pPlan);
return pTaskInfo; return pTaskInfo;
} }