/ Check-in [ec1e27e3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a reference count problem following database corruption detection in the ptrmapPut() routine of btree.c. (CVS 6854)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ec1e27e33b89e809a03e4140b351f6c8674c0233
User & Date: drh 2009-07-07 11:39:59
Context
2009-07-07
13:56
If an error occurs in PagerBegin(), call pager_end_transaction() to reset the internal state of the pager object. (CVS 6855) check-in: ea7ed166 user: danielk1977 tags: trunk
11:39
Fix a reference count problem following database corruption detection in the ptrmapPut() routine of btree.c. (CVS 6854) check-in: ec1e27e3 user: drh tags: trunk
02:44
Simplifications to btree.c and vdbeaux.c in support of structural coverage testing. (CVS 6853) check-in: fc2a40a9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.654 2009/07/07 02:44:07 drh Exp $
           12  +** $Id: btree.c,v 1.655 2009/07/07 11:39:59 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** See the header comment on "btreeInt.h" for additional information.
    16     16   ** Including a description of file format and an overview of operation.
    17     17   */
    18     18   #include "btreeInt.h"
    19     19   
................................................................................
   736    736     iPtrmap = PTRMAP_PAGENO(pBt, key);
   737    737     rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);
   738    738     if( rc!=SQLITE_OK ){
   739    739       return rc;
   740    740     }
   741    741     offset = PTRMAP_PTROFFSET(iPtrmap, key);
   742    742     if( offset<0 ){
   743         -    return SQLITE_CORRUPT_BKPT;
          743  +    rc = SQLITE_CORRUPT_BKPT;
          744  +    goto ptrmap_exit;
   744    745     }
   745    746     pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
   746    747   
   747    748     if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
   748    749       TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
   749    750       rc = sqlite3PagerWrite(pDbPage);
   750    751       if( rc==SQLITE_OK ){
   751    752         pPtrmap[offset] = eType;
   752    753         put4byte(&pPtrmap[offset+1], parent);
   753    754       }
   754    755     }
   755    756   
          757  +ptrmap_exit:
   756    758     sqlite3PagerUnref(pDbPage);
   757    759     return rc;
   758    760   }
   759    761   
   760    762   /*
   761    763   ** Read an entry from the pointer map.
   762    764   **