fix mem leak
This commit is contained in:
parent
d1bfc48439
commit
5cadc797a4
|
@ -1093,6 +1093,7 @@ static int stmtFetchStbColFields2(STscStmt2* pStmt, int32_t* fieldNum, TAOS_FIEL
|
||||||
STMT_ERR_RET(qBuildStmtStbColFields(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.preCtbname, fieldNum, fields));
|
STMT_ERR_RET(qBuildStmtStbColFields(*pDataBlock, pStmt->bInfo.boundTags, pStmt->bInfo.preCtbname, fieldNum, fields));
|
||||||
if (pStmt->bInfo.tbType == TSDB_SUPER_TABLE) {
|
if (pStmt->bInfo.tbType == TSDB_SUPER_TABLE) {
|
||||||
pStmt->bInfo.needParse = true;
|
pStmt->bInfo.needParse = true;
|
||||||
|
qDestroyStmtDataBlock(*pDataBlock);
|
||||||
if (taosHashRemove(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)) != 0) {
|
if (taosHashRemove(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName)) != 0) {
|
||||||
tscError("get fileds %s remove exec blockHash fail", pStmt->bInfo.tbFName);
|
tscError("get fileds %s remove exec blockHash fail", pStmt->bInfo.tbFName);
|
||||||
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
|
|
|
@ -1849,7 +1849,6 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
||||||
tstrncpy(pStbRowsCxt->ctbName.tname, tbName, sizeof(pStbRowsCxt->ctbName.tname));
|
tstrncpy(pStbRowsCxt->ctbName.tname, tbName, sizeof(pStbRowsCxt->ctbName.tname));
|
||||||
tstrncpy(pStmt->usingTableName.tname, pStmt->targetTableName.tname, sizeof(pStmt->usingTableName.tname));
|
tstrncpy(pStmt->usingTableName.tname, pStmt->targetTableName.tname, sizeof(pStmt->usingTableName.tname));
|
||||||
tstrncpy(pStmt->targetTableName.tname, tbName, sizeof(pStmt->targetTableName.tname));
|
tstrncpy(pStmt->targetTableName.tname, tbName, sizeof(pStmt->targetTableName.tname));
|
||||||
|
|
||||||
tstrncpy(pStmt->usingTableName.dbname, pStmt->targetTableName.dbname, sizeof(pStmt->usingTableName.dbname));
|
tstrncpy(pStmt->usingTableName.dbname, pStmt->targetTableName.dbname, sizeof(pStmt->usingTableName.dbname));
|
||||||
pStmt->usingTableName.type = 1;
|
pStmt->usingTableName.type = 1;
|
||||||
pStmt->pTableMeta->tableType = TSDB_CHILD_TABLE; // set the table type to child table for parse cache
|
pStmt->pTableMeta->tableType = TSDB_CHILD_TABLE; // set the table type to child table for parse cache
|
||||||
|
@ -2060,9 +2059,7 @@ static int32_t parseStbBoundInfo(SVnodeModifyOpStmt* pStmt, SStbRowsDataContext*
|
||||||
|
|
||||||
insDestroyBoundColInfo(&((*ppTableDataCxt)->boundColsInfo));
|
insDestroyBoundColInfo(&((*ppTableDataCxt)->boundColsInfo));
|
||||||
(*ppTableDataCxt)->boundColsInfo = pStbRowsCxt->boundColsInfo;
|
(*ppTableDataCxt)->boundColsInfo = pStbRowsCxt->boundColsInfo;
|
||||||
(*ppTableDataCxt)->boundColsInfo.numOfCols = pStbRowsCxt->boundColsInfo.numOfBound;
|
|
||||||
(*ppTableDataCxt)->boundColsInfo.numOfBound = pStbRowsCxt->boundColsInfo.numOfBound;
|
|
||||||
(*ppTableDataCxt)->boundColsInfo.hasBoundCols = pStbRowsCxt->boundColsInfo.hasBoundCols;
|
|
||||||
(*ppTableDataCxt)->boundColsInfo.pColIndex = taosMemoryCalloc(pStbRowsCxt->boundColsInfo.numOfBound, sizeof(int16_t));
|
(*ppTableDataCxt)->boundColsInfo.pColIndex = taosMemoryCalloc(pStbRowsCxt->boundColsInfo.numOfBound, sizeof(int16_t));
|
||||||
if (NULL == (*ppTableDataCxt)->boundColsInfo.pColIndex) {
|
if (NULL == (*ppTableDataCxt)->boundColsInfo.pColIndex) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -3175,9 +3172,8 @@ int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatal
|
||||||
.isStmtBind = pCxt->isStmtBind};
|
.isStmtBind = pCxt->isStmtBind};
|
||||||
|
|
||||||
int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery);
|
int32_t code = initInsertQuery(&context, pCatalogReq, pMetaData, pQuery);
|
||||||
SVnodeModifyOpStmt* pStmt = (SVnodeModifyOpStmt*)((*pQuery)->pRoot);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = parseInsertSqlImpl(&context, pStmt);
|
code = parseInsertSqlImpl(&context, (SVnodeModifyOpStmt*)((*pQuery)->pRoot));
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setNextStageInfo(&context, *pQuery, pCatalogReq);
|
code = setNextStageInfo(&context, *pQuery, pCatalogReq);
|
||||||
|
|
|
@ -606,6 +606,13 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
||||||
code = terrno;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
SVCreateTbReq* tmp = pDataBlock->pData->pCreateTbReq;
|
||||||
|
taosMemoryFreeClear(tmp->name);
|
||||||
|
taosMemoryFreeClear(tmp->ctb.pTag);
|
||||||
|
taosMemoryFreeClear(tmp->ctb.stbName);
|
||||||
|
taosArrayDestroy(tmp->ctb.tagName);
|
||||||
|
tmp->ctb.tagName = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
||||||
|
|
|
@ -33,7 +33,7 @@ void do_stmt(TAOS* taos) {
|
||||||
|
|
||||||
char* tbs[2] = {"tb", "tb2"};
|
char* tbs[2] = {"tb", "tb2"};
|
||||||
int t1_val[2] = {0, 1};
|
int t1_val[2] = {0, 1};
|
||||||
int t2_len[2] = {10, 10};
|
int t2_len[2] = {5, 5};
|
||||||
int t3_len[2] = {sizeof(int), sizeof(int)};
|
int t3_len[2] = {sizeof(int), sizeof(int)};
|
||||||
TAOS_STMT2_BIND tags[2][2] = {{{0, &t1_val[0], &t3_len[0], NULL, 0}, {0, "after1", &t2_len[0], NULL, 0}},
|
TAOS_STMT2_BIND tags[2][2] = {{{0, &t1_val[0], &t3_len[0], NULL, 0}, {0, "after1", &t2_len[0], NULL, 0}},
|
||||||
{{0, &t1_val[1], &t3_len[1], NULL, 0}, {0, "after2", &t2_len[1], NULL, 0}}};
|
{{0, &t1_val[1], &t3_len[1], NULL, 0}, {0, "after2", &t2_len[1], NULL, 0}}};
|
||||||
|
@ -87,7 +87,7 @@ void do_stmt(TAOS* taos) {
|
||||||
taos_stmt2_close(stmt);
|
taos_stmt2_close(stmt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
taos_stmt2_free_stb_fields(stmt, pFields);
|
||||||
taos_stmt2_close(stmt);
|
taos_stmt2_close(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue