/ Check-in [3cab9022]
Login

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

Overview
Comment:Fix for a segfault that can follow a malloc failure.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal-refactor
Files: files | file ages | folders
SHA1:3cab9022457ce50f82c5822d8ba6c04a3a85cb6a
User & Date: dan 2010-05-13 07:08:54
Context
2010-05-13
08:33
Change the xShmSize() implementation in os_unix.c so that it will only increase and never decrease the size of a shared-memory segment. Closed-Leaf check-in: 149d2ae4 user: drh tags: wal-refactor
07:08
Fix for a segfault that can follow a malloc failure. check-in: 3cab9022 user: dan tags: wal-refactor
06:19
Modify the VFS in test_vfs.c to match the refactoring of the xShmXXX methods. check-in: 25e72f81 user: dan tags: wal-refactor
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wal.c.

698
699
700
701
702
703
704
705
706
707
708

709
710
711
712
713
714
715

  pRet->pVfs = pVfs;
  pRet->pWalFd = (sqlite3_file *)&pRet[1];
  pRet->pDbFd = pDbFd;
  pRet->zWalName = zWal = pVfs->szOsFile + (char*)pRet->pWalFd;
  sqlite3_snprintf(nWal, zWal, "%s-wal", zDbName);
  rc = sqlite3OsShmOpen(pDbFd);
  pRet->isWindexOpen = 1;

  /* Open file handle on the write-ahead log file. */
  if( rc==SQLITE_OK ){

    flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
    rc = sqlite3OsOpen(pVfs, zWal, pRet->pWalFd, flags, &flags);
  }

  if( rc!=SQLITE_OK ){
    walIndexClose(pRet, 0);
    sqlite3OsClose(pRet->pWalFd);







<



>







698
699
700
701
702
703
704

705
706
707
708
709
710
711
712
713
714
715

  pRet->pVfs = pVfs;
  pRet->pWalFd = (sqlite3_file *)&pRet[1];
  pRet->pDbFd = pDbFd;
  pRet->zWalName = zWal = pVfs->szOsFile + (char*)pRet->pWalFd;
  sqlite3_snprintf(nWal, zWal, "%s-wal", zDbName);
  rc = sqlite3OsShmOpen(pDbFd);


  /* Open file handle on the write-ahead log file. */
  if( rc==SQLITE_OK ){
    pRet->isWindexOpen = 1;
    flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MAIN_JOURNAL);
    rc = sqlite3OsOpen(pVfs, zWal, pRet->pWalFd, flags, &flags);
  }

  if( rc!=SQLITE_OK ){
    walIndexClose(pRet, 0);
    sqlite3OsClose(pRet->pWalFd);