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

Fix a reference count problem following database corruption detection in

the ptrmapPut() routine of btree.c. (CVS 6854)

FossilOrigin-Name: ec1e27e33b89e809a03e4140b351f6c8674c0233
This commit is contained in:
drh
2009-07-07 11:39:58 +00:00
parent fa3be90471
commit 4925a55d14
3 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
C Simplifications\sto\sbtree.c\sand\svdbeaux.c\sin\ssupport\sof\sstructural\scoverage\ntesting.\s(CVS\s6853) C Fix\sa\sreference\scount\sproblem\sfollowing\sdatabase\scorruption\sdetection\sin\nthe\sptrmapPut()\sroutine\sof\sbtree.c.\s(CVS\s6854)
D 2009-07-07T02:44:07 D 2009-07-07T11:39:59
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -106,7 +106,7 @@ F src/auth.c 802a9439dfa0b8c208b10055cba400e82ef18025
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3 F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119 F src/bitvec.c 0ef0651714728055d43de7a4cdd95e703fac0119
F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c F src/btmutex.c 9b899c0d8df3bd68f527b0afe03088321b696d3c
F src/btree.c efad7a5ac6c460aa326de8df290e72af54b2a96e F src/btree.c 8f4c2ebdc9f0e0139f5878fac8ac96b12528b014
F src/btree.h e761619e76a1125d2d82bd3613b5a7ac7d1ee6f7 F src/btree.h e761619e76a1125d2d82bd3613b5a7ac7d1ee6f7
F src/btreeInt.h b31e5ac04181c7e2892c33ab06228c551df6233c F src/btreeInt.h b31e5ac04181c7e2892c33ab06228c551df6233c
F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4 F src/build.c 867028ee9f63f7bc8eb8d4a720bb98cf9b9a12b4
@@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
P 31a5e8192e164f01c5d7c2744b67cfb517251fad P fc2a40a9db23285da16f40f5131613907fb80f02
R 100495e4081a84deef5f1cdee7a55f95 R 067e52bffc46b1e850298e3bb4524f93
U drh U drh
Z 8f0c5bdca0336a3f4c49fe6be74bffd7 Z fdbf1e48a2965ae7334046f98d17d69c

View File

@@ -1 +1 @@
fc2a40a9db23285da16f40f5131613907fb80f02 ec1e27e33b89e809a03e4140b351f6c8674c0233

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.654 2009/07/07 02:44:07 drh Exp $ ** $Id: btree.c,v 1.655 2009/07/07 11:39:59 drh Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@@ -740,7 +740,8 @@ static int ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent){
} }
offset = PTRMAP_PTROFFSET(iPtrmap, key); offset = PTRMAP_PTROFFSET(iPtrmap, key);
if( offset<0 ){ if( offset<0 ){
return SQLITE_CORRUPT_BKPT; rc = SQLITE_CORRUPT_BKPT;
goto ptrmap_exit;
} }
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
@@ -753,6 +754,7 @@ static int ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent){
} }
} }
ptrmap_exit:
sqlite3PagerUnref(pDbPage); sqlite3PagerUnref(pDbPage);
return rc; return rc;
} }