提交 f38f6917 编写于 作者: Y yifan hao

[vnode] Fix a few error handling as well as memory leak

1. Fix error handling in vnodeProcessQueryMsg() where qCreateQueryInfo()
fails.
2. Inside qCreateQueryInfo(), cleanup pQInfo upon failure, also add a
missing goto statement.
上级 5f132980
......@@ -6131,6 +6131,7 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi
(*pQInfo) = createQInfoImpl(pQueryMsg, pGroupbyExpr, pExprs, &groupInfo, pTagColumnInfo);
if ((*pQInfo) == NULL) {
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
goto _query_over;
}
code = initQInfo(pQueryMsg, tsdb, vgId, *pQInfo, isSTableQuery);
......@@ -6140,6 +6141,11 @@ _query_over:
tfree(tbnameCond);
taosArrayDestroy(pTableIdList);
if (code != TSDB_CODE_SUCCESS) {
tfree(*pQInfo);
*pQInfo = NULL;
}
// if failed to add ref for all meters in this query, abort current query
// atomic_fetch_add_32(&vnodeSelectReqNum, 1);
return code;
......
......@@ -67,11 +67,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
dTrace("pVnode:%p vgId:%d QInfo:%p, dnode query msg disposed", pVnode, pVnode->vgId, pQInfo);
} else {
assert(pCont != NULL);
pQInfo = pCont;
code = TSDB_CODE_ACTION_IN_PROGRESS;
}
if (pQInfo != NULL) {
qTableQuery(pQInfo); // do execute query
}
return code;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册