/ Check-in [05d34626]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a segfault introduced by (5720) that can follow an IO error. (CVS 5721)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 05d3462688507b61710cbda27adf61d0b0514e27
User & Date: danielk1977 2008-09-18 18:17:04
Context
2008-09-18
18:18
Do not run the async tests if the async module is not installed. (CVS 5722) check-in: 4de71a4e user: drh tags: trunk
18:17
Fix a segfault introduced by (5720) that can follow an IO error. (CVS 5721) check-in: 05d34626 user: danielk1977 tags: trunk
17:34
Avoid parsing the structure of b-tree pages (in sqlite3BtreeInitPage) more than is necessary. (CVS 5720) check-in: 6b998f30 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace 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.513 2008/09/18 17:34:44 danielk1977 Exp $
           12  +** $Id: btree.c,v 1.514 2008/09/18 18:17:04 danielk1977 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   
................................................................................
  4949   4949       */
  4950   4950       if( ISAUTOVACUUM ){
  4951   4951         rc = ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno);
  4952   4952         if( rc==SQLITE_OK ){
  4953   4953           rc = ptrmapPutOvfl(pNew, 0);
  4954   4954         }
  4955   4955       }
         4956  +
         4957  +    /* Release the reference to the new page. */
         4958  +    releasePage(pNew);
  4956   4959     }
  4957   4960   
  4958   4961     /* At this point the pPage->nFree variable is not set correctly with
  4959   4962     ** respect to the content of the page (because it was set to 0 by 
  4960   4963     ** insertCell). So call sqlite3BtreeInitPage() to make sure it is
  4961   4964     ** correct.
  4962   4965     **
................................................................................
  4968   4971     ** it will not be rolled back and so it is important to make sure that
  4969   4972     ** the page data and contents of MemPage are consistent.
  4970   4973     */
  4971   4974     pPage->isInit = 0;
  4972   4975     sqlite3BtreeInitPage(pPage, pPage->pParent);
  4973   4976     sqlite3PagerUnref(pPage->pParent->pDbPage);
  4974   4977   
  4975         -  /* Release the reference to the new page and balance the parent page,
  4976         -  ** in case the divider cell inserted caused it to become overfull.
         4978  +  /* If everything else succeeded, balance the parent page, in 
         4979  +  ** case the divider cell inserted caused it to become overfull.
  4977   4980     */
  4978         -  releasePage(pNew);
  4979   4981     if( rc==SQLITE_OK ){
  4980   4982       rc = balance(pParent, 0);
  4981   4983     }
  4982   4984     return rc;
  4983   4985   }
  4984   4986   #endif /* SQLITE_OMIT_QUICKBALANCE */
  4985   4987