Merge pull request #17935 from taosdata/fix/TD-20246

fix: fix tsdbRead crash caused by reuse after free
This commit is contained in:
dapan1121 2022-11-08 17:48:25 +08:00 committed by GitHub
commit d5874419ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -366,9 +366,9 @@ static void clearBlockScanInfo(STableBlockScanInfo* p) {
tMapDataClear(&p->mapData);
}
static void destroyAllBlockScanInfo(SHashObj* pTableMap) {
static void destroyAllBlockScanInfo(SHashObj* pTableMap, bool clearEntry) {
void* p = NULL;
while ((p = taosHashIterate(pTableMap, p)) != NULL) {
while (clearEntry && ((p = taosHashIterate(pTableMap, p)) != NULL)) {
clearBlockScanInfo(*(STableBlockScanInfo**)p);
}
@ -3768,7 +3768,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
cleanupDataBlockIterator(&pReader->status.blockIter);
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
destroyAllBlockScanInfo(pReader->status.pTableMap);
destroyAllBlockScanInfo(pReader->status.pTableMap, (pReader->innerReader[0] == NULL) ? true : false);
blockDataDestroy(pReader->pResBlock);
clearBlockScanInfoBuf(&pReader->blockInfoBuf);