fix: free unallocated memory in tsdbRowClose()

This commit is contained in:
Haolin Wang 2024-12-24 08:09:35 +08:00
parent 56079acc5f
commit 493a23a480
2 changed files with 5 additions and 5 deletions

View File

@ -610,6 +610,7 @@ int32_t tsdbLoadFromImem(SMemTable *imem, int64_t suid, int64_t uid) {
int32_t nCol; int32_t nCol;
SArray *ctxArray = pTsdb->rCache.ctxArray; SArray *ctxArray = pTsdb->rCache.ctxArray;
STsdbRowKey tsdbRowKey = {0}; STsdbRowKey tsdbRowKey = {0};
STSDBRowIter iter = {0};
STbData *pIMem = tsdbGetTbDataFromMemTable(imem, suid, uid); STbData *pIMem = tsdbGetTbDataFromMemTable(imem, suid, uid);
@ -641,7 +642,6 @@ int32_t tsdbLoadFromImem(SMemTable *imem, int64_t suid, int64_t uid) {
tsdbRowGetKey(pMemRow, &tsdbRowKey); tsdbRowGetKey(pMemRow, &tsdbRowKey);
STSDBRowIter iter = {0};
TAOS_CHECK_EXIT(tsdbRowIterOpen(&iter, pMemRow, pTSchema)); TAOS_CHECK_EXIT(tsdbRowIterOpen(&iter, pMemRow, pTSchema));
int32_t iCol = 0; int32_t iCol = 0;
@ -685,7 +685,6 @@ int32_t tsdbLoadFromImem(SMemTable *imem, int64_t suid, int64_t uid) {
STsdbRowKey tsdbRowKey = {0}; STsdbRowKey tsdbRowKey = {0};
tsdbRowGetKey(pMemRow, &tsdbRowKey); tsdbRowGetKey(pMemRow, &tsdbRowKey);
STSDBRowIter iter = {0};
TAOS_CHECK_EXIT(tsdbRowIterOpen(&iter, pMemRow, pTSchema)); TAOS_CHECK_EXIT(tsdbRowIterOpen(&iter, pMemRow, pTSchema));
int32_t iCol = 0; int32_t iCol = 0;
@ -2470,6 +2469,7 @@ static int32_t tsdbCacheGetBatchFromMem(STsdb *pTsdb, tb_uid_t uid, SArray *pLas
int numKeys = TARRAY_SIZE(pCidList); int numKeys = TARRAY_SIZE(pCidList);
MemNextRowIter iter = {0}; MemNextRowIter iter = {0};
SSHashObj *iColHash = NULL; SSHashObj *iColHash = NULL;
STSDBRowIter rowIter = {0};
// 1, get from mem, imem filtered with delete info // 1, get from mem, imem filtered with delete info
TAOS_CHECK_EXIT(memRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pReadSnap, pr)); TAOS_CHECK_EXIT(memRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->info.suid, pr->pReadSnap, pr));
@ -2490,7 +2490,6 @@ static int32_t tsdbCacheGetBatchFromMem(STsdb *pTsdb, tb_uid_t uid, SArray *pLas
STsdbRowKey rowKey = {0}; STsdbRowKey rowKey = {0};
tsdbRowGetKey(pRow, &rowKey); tsdbRowGetKey(pRow, &rowKey);
STSDBRowIter rowIter = {0};
TAOS_CHECK_EXIT(tsdbRowIterOpen(&rowIter, pRow, pTSchema)); TAOS_CHECK_EXIT(tsdbRowIterOpen(&rowIter, pRow, pTSchema));
int32_t iCol = 0, jCol = 0, jnCol = TARRAY_SIZE(pLastArray); int32_t iCol = 0, jCol = 0, jnCol = TARRAY_SIZE(pLastArray);
@ -2564,7 +2563,6 @@ static int32_t tsdbCacheGetBatchFromMem(STsdb *pTsdb, tb_uid_t uid, SArray *pLas
STsdbRowKey tsdbRowKey = {0}; STsdbRowKey tsdbRowKey = {0};
tsdbRowGetKey(pRow, &tsdbRowKey); tsdbRowGetKey(pRow, &tsdbRowKey);
STSDBRowIter rowIter = {0};
TAOS_CHECK_EXIT(tsdbRowIterOpen(&rowIter, pRow, pTSchema)); TAOS_CHECK_EXIT(tsdbRowIterOpen(&rowIter, pRow, pTSchema));
iCol = 0; iCol = 0;

View File

@ -699,9 +699,11 @@ int32_t tsdbRowIterOpen(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema)
} }
void tsdbRowClose(STSDBRowIter *pIter) { void tsdbRowClose(STSDBRowIter *pIter) {
if (pIter->pRow->type == TSDBROW_ROW_FMT) { if (pIter->pRow && pIter->pRow->type == TSDBROW_ROW_FMT) {
tRowIterClose(&pIter->pIter); tRowIterClose(&pIter->pIter);
} }
pIter->pRow = NULL;
pIter->pIter = NULL;
} }
SColVal *tsdbRowIterNext(STSDBRowIter *pIter) { SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {