fix: memory leak issue

This commit is contained in:
dapan1121 2023-04-24 10:41:28 +08:00
parent 905df6f7ac
commit 8480c42234
1 changed files with 6 additions and 5 deletions

View File

@ -1376,11 +1376,11 @@ int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
char* pCond = taosHashGet(pTbs, tbFName, strlen(tbFName)); char* pCond = taosHashGet(pTbs, tbFName, strlen(tbFName));
if (pCond) { if (pCond) {
if (strlen(pCond) > 1) { if (strlen(pCond) > 1) {
CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); CTG_ERR_JRET(nodesStringToNode(pCond, &res->pRawRes->pCond));
} }
res->pRawRes->pass = true; res->pRawRes->pass = true;
return TSDB_CODE_SUCCESS; goto _return;
} }
if (stbName) { if (stbName) {
@ -1388,19 +1388,19 @@ int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
goto _return; goto _return;
} }
CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta)); CTG_ERR_JRET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta));
if (NULL == pMeta) { if (NULL == pMeta) {
if (req->onlyCache) { if (req->onlyCache) {
res->metaNotExists = true; res->metaNotExists = true;
ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname); ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
return TSDB_CODE_SUCCESS; goto _return;
} }
SCtgTbMetaCtx ctx = {0}; SCtgTbMetaCtx ctx = {0};
ctx.pName = (SName*)&req->pRawReq->tbName; ctx.pName = (SName*)&req->pRawReq->tbName;
ctx.flag = CTG_FLAG_UNKNOWN_STB | CTG_FLAG_SYNC_OP; ctx.flag = CTG_FLAG_UNKNOWN_STB | CTG_FLAG_SYNC_OP;
CTG_ERR_RET(ctgGetTbMeta(pCtg, req->pConn, &ctx, &pMeta)); CTG_ERR_JRET(ctgGetTbMeta(pCtg, req->pConn, &ctx, &pMeta));
} }
if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) { if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) {
@ -1431,6 +1431,7 @@ int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
_return: _return:
taosMemoryFree(pMeta); taosMemoryFree(pMeta);
taosMemoryFree(stbName);
CTG_RET(code); CTG_RET(code);
} }