提交 820de153 编写于 作者: H Hongze Cheng

fix invalid read

上级 20b1c0d2
...@@ -712,7 +712,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -712,7 +712,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
} }
{ // Do the real cell distribution { // Do the real cell distribution
SPage *pOldsCopy[3]; SPage *pOldsCopy[3] = {0};
SCell *pCell; SCell *pCell;
int szCell; int szCell;
SBtreeInitPageArg iarg; SBtreeInitPageArg iarg;
...@@ -722,7 +722,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ...@@ -722,7 +722,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
iarg.pBt = pBt; iarg.pBt = pBt;
iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]); iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]);
for (int i = 0; i < nOlds; i++) { 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); tdbBtreeZeroPage(pOldsCopy[i], &iarg);
tdbPageCopy(pOlds[i], pOldsCopy[i]); tdbPageCopy(pOlds[i], pOldsCopy[i]);
} }
......
...@@ -52,7 +52,7 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t) ...@@ -52,7 +52,7 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t)
} }
ptr = (u8 *)((*xMalloc)(arg, size)); ptr = (u8 *)((*xMalloc)(arg, size));
if (pPage == NULL) { if (ptr == NULL) {
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册