fix(query)[TD-32564]. Fix memory leak in exceptional cases

In function tsdbTFileSetInitRef, clear all FileObj stored in
the variable lvl when an error occurs, and release the memory
allocated for lvl itself.
This commit is contained in:
Jinqing Kuang 2024-10-16 10:48:41 +08:00
parent 28ca8ad591
commit de70067436
1 changed files with 2 additions and 2 deletions

View File

@ -602,14 +602,14 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
SSttLvl *lvl;
code = tsdbSttLvlInitRef(pTsdb, lvl1, &lvl);
if (code) {
taosMemoryFree(lvl);
tsdbSttLvlClear(&lvl);
tsdbTFileSetClear(fset);
return code;
}
code = TARRAY2_APPEND(fset[0]->lvlArr, lvl);
if (code) {
taosMemoryFree(lvl);
tsdbSttLvlClear(&lvl);
tsdbTFileSetClear(fset);
return code;
}