/ Check-in [b724aa58]
Login

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

Overview
Comment:Fix a problem in btree.c that could cause a crash following an OOM.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: b724aa5889f2e09cf0cbef133a672e6486755104
User & Date: dan 2013-04-01 14:29:33
Context
2013-04-01
14:35
Fix a typo in a log message in wal.c. check-in: 83fc48d1 user: dan tags: experimental-mmap
14:29
Fix a problem in btree.c that could cause a crash following an OOM. check-in: b724aa58 user: dan tags: experimental-mmap
2013-03-26
18:48
Fix a comment in os_unix.c. No code changes. check-in: 72813b8e user: drh tags: experimental-mmap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

  2592   2592   
  2593   2593     for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
  2594   2594       if( pCsr->iPage>=0 ){
  2595   2595         MemPage *pPg = pCsr->apPage[0];
  2596   2596         if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
  2597   2597           MemPage *pNew = 0;
  2598   2598           rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
  2599         -        if( rc==SQLITE_OK && pCsr->iPage==0 ){
  2600         -          pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
         2599  +        if( rc==SQLITE_OK ){
         2600  +          if( pCsr->iPage==0 ){
         2601  +            pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
         2602  +          }
         2603  +          pCsr->apPage[0] = pNew;
         2604  +          releasePage(pPg);
  2601   2605           }
  2602         -        pCsr->apPage[0] = pNew;
  2603         -        releasePage(pPg);
  2604         -        if( rc!=SQLITE_OK ) return rc;
  2605   2606         }
  2606   2607       }
  2607   2608     }
  2608   2609   
  2609   2610     return rc;
  2610   2611   }
  2611   2612