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

Avoid leaking page references after an IO error is encountered. (CVS 5082)

FossilOrigin-Name: 198c395b01140ef48b6913c00188ba7168bfb081
This commit is contained in:
danielk1977
2008-05-05 15:26:50 +00:00
parent 344c38e340
commit 4abd5449e8
5 changed files with 43 additions and 34 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.454 2008/05/05 12:09:33 danielk1977 Exp $
** $Id: btree.c,v 1.455 2008/05/05 15:26:51 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -6835,16 +6835,12 @@ static int btreeCopyFile(Btree *pTo, Btree *pFrom){
** present in pTo before the copy operation, journal page i from pTo.
*/
if( i!=iSkip && i<=nToPage ){
DbPage *pDbPage;
DbPage *pDbPage = 0;
rc = sqlite3PagerGet(pBtTo->pPager, i, &pDbPage);
if( rc ){
break;
if( rc==SQLITE_OK ){
rc = sqlite3PagerWrite(pDbPage);
}
rc = sqlite3PagerWrite(pDbPage);
if( rc ){
break;
}
if( i>nFromPage ){
if( rc==SQLITE_OK && i>nFromPage ){
/* Yeah. It seems wierd to call DontWrite() right after Write(). But
** that is because the names of those procedures do not exactly
** represent what they do. Write() really means "put this page in the