fix invalid read

This commit is contained in:
Hongze Cheng 2022-03-24 05:46:59 +00:00
parent 20b1c0d236
commit 820de153a8
2 changed files with 3 additions and 3 deletions

View File

@ -712,7 +712,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
}
{ // Do the real cell distribution
SPage *pOldsCopy[3];
SPage *pOldsCopy[3] = {0};
SCell *pCell;
int szCell;
SBtreeInitPageArg iarg;
@ -722,7 +722,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
iarg.pBt = pBt;
iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]);
for (int i = 0; i < nOlds; i++) {
tdbPageCreate(pOlds[0]->pageSize, pOldsCopy + i, NULL, NULL);
tdbPageCreate(pOlds[0]->pageSize, &pOldsCopy[i], NULL, NULL);
tdbBtreeZeroPage(pOldsCopy[i], &iarg);
tdbPageCopy(pOlds[i], pOldsCopy[i]);
}

View File

@ -52,7 +52,7 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t)
}
ptr = (u8 *)((*xMalloc)(arg, size));
if (pPage == NULL) {
if (ptr == NULL) {
return -1;
}