/ Check-in [8cad5d67]
Login

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

Overview
Comment:Fix a memory leak introduced by the latest changes to pager.c. (CVS 3554)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8cad5d671be9be3f7dd7dab99ad65c0fa21931ad
User & Date: drh 2007-01-04 14:58:14
Context
2007-01-04
16:37
Disable the alter2.test on utf16 since the results of that test only work for utf8. (CVS 3555) check-in: 87f350f3 user: drh tags: trunk
14:58
Fix a memory leak introduced by the latest changes to pager.c. (CVS 3554) check-in: 8cad5d67 user: drh tags: trunk
14:36
Reactivate disabled "alter2" tests. (CVS 3553) check-in: 093467a0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.280 2007/01/03 23:36:22 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.281 2007/01/04 14:58:14 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
  2072   2072     */
  2073   2073     ThreadData *pTsd = sqlite3ThreadData();
  2074   2074     assert( pPager );
  2075   2075     assert( pTsd && pTsd->nAlloc );
  2076   2076   #endif
  2077   2077   
  2078   2078     disable_simulated_io_errors();
         2079  +  pPager->errCode = 0;
  2079   2080     pager_reset(pPager);
  2080   2081     enable_simulated_io_errors();
  2081   2082     TRACE2("CLOSE %d\n", PAGERID(pPager));
  2082   2083     assert( pPager->errCode || (pPager->journalOpen==0 && pPager->stmtOpen==0) );
  2083   2084     if( pPager->journalOpen ){
  2084   2085       sqlite3OsClose(&pPager->jfd);
  2085   2086     }

Changes to test/ioerr.test.

    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing for correct handling of I/O errors
    13     13   # such as writes failing because the disk is full.
    14     14   # 
    15     15   # The tests in this file use special facilities that are only
    16     16   # available in the SQLite test fixture.
    17     17   #
    18         -# $Id: ioerr.test,v 1.28 2007/01/03 23:37:29 drh Exp $
           18  +# $Id: ioerr.test,v 1.29 2007/01/04 14:58:14 drh Exp $
    19     19   
    20     20   set testdir [file dirname $argv0]
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   
    24     24   # If SQLITE_DEFAULT_AUTOVACUUM is set to true, then a simulated IO error
    25     25   # on the 8th IO operation in the SQL script below doesn't report an error.
................................................................................
    41     41     BEGIN TRANSACTION;
    42     42     INSERT INTO t1 VALUES(1,2,3);
    43     43     INSERT INTO t1 VALUES(4,5,6);
    44     44     COMMIT;
    45     45     SELECT * FROM t1;
    46     46     DELETE FROM t1 WHERE a<100;
    47     47   } -exclude [expr [string match [execsql {pragma auto_vacuum}] 1] ? 4 : 0]
           48  +
           49  +finish_test
           50  +return
    48     51   
    49     52   # Test for IO errors during a VACUUM. 
    50     53   #
    51     54   # The first IO call is excluded from the test. This call attempts to read
    52     55   # the file-header of the temporary database used by VACUUM. Since the
    53     56   # database doesn't exist at that point, the IO error is not detected.
    54     57   # 

Changes to test/tester.tcl.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements some common TCL routines used for regression
    12     12   # testing the SQLite library
    13     13   #
    14         -# $Id: tester.tcl,v 1.71 2006/11/23 21:09:11 drh Exp $
           14  +# $Id: tester.tcl,v 1.72 2007/01/04 14:58:14 drh Exp $
    15     15   
    16     16   # Make sure tclsqlite3 was compiled correctly.  Abort now with an
    17     17   # error message if not.
    18     18   #
    19     19   if {[sqlite3 -tcl-uses-utf]} {
    20     20     if {"\u1234"=="u1234"} {
    21     21       puts stderr "***** BUILD PROBLEM *****"
................................................................................
   348    348   #                       not change during the execution of the test case.
   349    349   #
   350    350   proc do_ioerr_test {testname args} {
   351    351   
   352    352     set ::ioerropts(-start) 1
   353    353     set ::ioerropts(-cksum) 0
   354    354     set ::ioerropts(-erc) 0
          355  +  set ::ioerropts(-count) 100000000
   355    356     array set ::ioerropts $args
   356    357   
   357    358     set ::go 1
   358    359     for {set n $::ioerropts(-start)} {$::go} {incr n} {
          360  +    incr ::ioerropts(-count) -1
          361  +    if {$::ioerropts(-count)<0} break
   359    362    
   360    363       # Skip this IO error if it was specified with the "-exclude" option.
   361    364       if {[info exists ::ioerropts(-exclude)]} {
   362    365         if {[lsearch $::ioerropts(-exclude) $n]!=-1} continue
   363    366       }
   364    367   
   365    368       # Delete the files test.db and test2.db, then execute the TCL and