/ Check-in [b724aa58]
Login
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 Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

2592
2593
2594
2595
2596
2597
2598
2599

2600
2601
2602
2603
2604

2605
2606
2607
2608
2609
2610
2611

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
        if( rc==SQLITE_OK && pCsr->iPage==0 ){

          pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
        }
        pCsr->apPage[0] = pNew;
        releasePage(pPg);
        if( rc!=SQLITE_OK ) return rc;

      }
    }
  }

  return rc;
}








|
>
|
|
|
|
<
>







2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604

2605
2606
2607
2608
2609
2610
2611
2612

  for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
    if( pCsr->iPage>=0 ){
      MemPage *pPg = pCsr->apPage[0];
      if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
        MemPage *pNew = 0;
        rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
        if( rc==SQLITE_OK ){
          if( pCsr->iPage==0 ){
            pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
          }
          pCsr->apPage[0] = pNew;
          releasePage(pPg);

        }
      }
    }
  }

  return rc;
}