fix: add memory free

This commit is contained in:
shenglian zhou 2023-10-24 16:23:03 +08:00
parent ae1bac251a
commit 27302f995b
1 changed files with 14 additions and 10 deletions

View File

@ -1715,8 +1715,8 @@ static int32_t parseOneStbRow(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pSt
taosArrayClear(pStbRowsCxt->aColVals); taosArrayClear(pStbRowsCxt->aColVals);
tTagFree(pStbRowsCxt->pTag); tTagFree(pStbRowsCxt->pTag);
taosMemoryFree(pStbRowsCxt->pCtbMeta); taosMemoryFree(pStbRowsCxt->pCtbMeta);
tdDestroySVCreateTbReq(pStmt->pCreateTblReq); tdDestroySVCreateTbReq(pStbRowsCxt->pCreateCtbReq);
taosMemoryFreeClear(pStmt->pCreateTblReq); taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq);
// child meta , vgroupid, check privilege // child meta , vgroupid, check privilege
// refer to parInsertSml.c // refer to parInsertSml.c
// create or reuse table data context from tbName // create or reuse table data context from tbName
@ -1969,11 +1969,15 @@ static int32_t parseDataClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pS
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z); return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", token.z);
} }
static void destroyStbRowsDataContext(SStbRowsDataContext* pStbRowsContext) { static void destroyStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
taosArrayDestroy(pStbRowsContext->aColVals); taosArrayDestroy(pStbRowsCxt->aColVals);
taosArrayDestroy(pStbRowsContext->aTagVals); taosArrayDestroy(pStbRowsCxt->aTagVals);
taosArrayDestroy(pStbRowsContext->aTagNames); taosArrayDestroy(pStbRowsCxt->aTagNames);
insDestroyBoundColInfo(&pStbRowsContext->boundColsInfo); insDestroyBoundColInfo(&pStbRowsCxt->boundColsInfo);
tTagFree(pStbRowsCxt->pTag);
taosMemoryFree(pStbRowsCxt->pCtbMeta);
tdDestroySVCreateTbReq(pStbRowsCxt->pCreateCtbReq);
taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq);
} }
static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
@ -1981,8 +1985,7 @@ static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModif
if (!pStmt->pBoundCols) { if (!pStmt->pBoundCols) {
return buildSyntaxErrMsg(&pCxt->msg, "(...tbname, ts...) bounded cols is expected for supertable insertion", pStmt->pSql); return buildSyntaxErrMsg(&pCxt->msg, "(...tbname, ts...) bounded cols is expected for supertable insertion", pStmt->pSql);
} }
SStbRowsDataContext* pStbRowsCxt; SStbRowsDataContext* pStbRowsCxt = taosMemoryCalloc(1, sizeof(SStbRowsDataContext));
pStbRowsCxt = taosMemoryCalloc(1, sizeof(SStbRowsDataContext));
if (!pStbRowsCxt) { if (!pStbRowsCxt) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
@ -2010,7 +2013,8 @@ static int32_t parseInsertStbClauseBottom(SInsertParseContext* pCxt, SVnodeModif
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = parseDataClause(pCxt, pStmt, rowsDataCxt); code = parseDataClause(pCxt, pStmt, rowsDataCxt);
} }
// destroyStbRowsDataContext; TODO: move it to resetEnvPreTable destroyStbRowsDataContext(pStbRowsCxt);
taosMemoryFree(pStbRowsCxt);
return code; return code;
} }