1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix integrity check so that it always reports memory allocation errors that

it encounters. (CVS 5984)

FossilOrigin-Name: 2a3f5ce14c050b135ab9d2247aee84ca37882c4b
This commit is contained in:
drh
2008-12-05 22:40:08 +00:00
parent 9bf9e9c86d
commit e43ba702bc
3 changed files with 13 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
C Make\ssure\sthe\snOverflow\sflag\sin\sMemPage\sis\sreset\sto\szero\safter\severy\sinsert.\s(CVS\s5983)
D 2008-12-05T20:01:43
C Fix\sintegrity\scheck\sso\sthat\sit\salways\sreports\smemory\sallocation\serrors\sthat\nit\sencounters.\s(CVS\s5984)
D 2008-12-05T22:40:08
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -100,7 +100,7 @@ F src/attach.c 85c6a3d0daf11965b47604190d7cf5597dc88382
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
F src/btree.c b3438bc1f262b8048df9949aeb2a14cf7c55e9bd
F src/btree.c 05fae412abe4f72aa52611f5a7180b73f2414d99
F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e
F src/btreeInt.h 8d21590c97b6a2c00cce1f78ed5dc5756e835108
F src/build.c ce642b06016d94b0dbc34d379bac82b597baf8d5
@@ -663,7 +663,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P adedd697b475dadaa2eeae0d0413603195c955cf
R 4b745e4c65ef95b4efde274748b84506
P bfde3dae0c7b97308344519ca06cd4b290e8cf47
R 8fe45c4a428cb7057f5995a2ae76463c
U drh
Z 4883cace950bdb143cdb09610e9fe51d
Z 3fd0d7ace73b7317cc5c4ac931c0196d

View File

@@ -1 +1 @@
bfde3dae0c7b97308344519ca06cd4b290e8cf47
2a3f5ce14c050b135ab9d2247aee84ca37882c4b

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.544 2008/12/05 20:01:43 drh Exp $
** $Id: btree.c,v 1.545 2008/12/05 22:40:08 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -6702,6 +6702,7 @@ static void checkPtrmap(
rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_NOMEM ) pCheck->mallocFailed = 1;
checkAppendMsg(pCheck, zContext, "Failed to read ptrmap key=%d", iChild);
return;
}
@@ -6828,11 +6829,13 @@ static int checkTreePage(
if( iPage==0 ) return 0;
if( checkRef(pCheck, iPage, zParentContext) ) return 0;
if( (rc = sqlite3BtreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){
if( rc==SQLITE_NOMEM ) pCheck->mallocFailed = 1;
checkAppendMsg(pCheck, zContext,
"unable to get the page. error code=%d", rc);
return 0;
}
if( (rc = sqlite3BtreeInitPage(pPage))!=0 ){
if( rc==SQLITE_NOMEM ) pCheck->mallocFailed = 1;
checkAppendMsg(pCheck, zContext,
"sqlite3BtreeInitPage() returns error code %d", rc);
releasePage(pPage);
@@ -6969,9 +6972,9 @@ check_page_abort:
** a table. nRoot is the number of entries in aRoot.
**
** Write the number of error seen in *pnErr. Except for some memory
** allocation errors, nn error message is held in memory obtained from
** allocation errors, an error message held in memory obtained from
** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is
** returned.
** returned. If a memory allocation error occurs, NULL is returned.
*/
char *sqlite3BtreeIntegrityCheck(
Btree *p, /* The btree to be checked */