fix possible ref problem

This commit is contained in:
Hongze Cheng 2022-03-06 03:16:08 +00:00
parent 4c32e5e35b
commit 31ee42e384
1 changed files with 5 additions and 2 deletions

View File

@ -79,7 +79,12 @@ SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage) {
SPage *pPage;
tdbPCacheLock(pCache);
pPage = tdbPCacheFetchImpl(pCache, pPgid, alcNewPage);
if (pPage) {
TDB_REF_PAGE(pPage);
}
tdbPCacheUnlock(pCache);
return pPage;
@ -129,7 +134,6 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe
if (pPage) {
tdbPCachePinPage(pPage);
}
TDB_REF_PAGE(pPage);
return pPage;
}
@ -158,7 +162,6 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, bool alcNe
pPage->pLruNext = NULL;
pPage->pPager = NULL;
tdbPCacheAddPageToHash(pPage);
TDB_REF_PAGE(pPage);
}
return pPage;