/ Check-in [e0d3aa75]
Login

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

Overview
Comment:Fix an assert() failure that can occur following a malloc() failure. Ticket #3455. (CVS 5834)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e0d3aa75b4fa0e706185a3058b5962916e30d066
User & Date: danielk1977 2008-10-22 10:45:38
Context
2008-10-22
16:04
Test cases for ticket #3442. (CVS 5835) check-in: a8bb5acf user: shane tags: trunk
10:45
Fix an assert() failure that can occur following a malloc() failure. Ticket #3455. (CVS 5834) check-in: e0d3aa75 user: danielk1977 tags: trunk
2008-10-21
04:30
Update the autoconf build system to include memjournal.c. (CVS 5833) check-in: a3c810f0 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.498 2008/10/06 16:18:40 danielk1977 Exp $
           25  +** $Id: build.c,v 1.499 2008/10/22 10:45:38 danielk1977 Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
  2397   2397       ){
  2398   2398         /* Because the parser constructs pTblName from a single identifier,
  2399   2399         ** sqlite3FixSrcList can never fail. */
  2400   2400         assert(0);
  2401   2401       }
  2402   2402       pTab = sqlite3LocateTable(pParse, 0, pTblName->a[0].zName, 
  2403   2403           pTblName->a[0].zDatabase);
  2404         -    if( !pTab ) goto exit_create_index;
         2404  +    if( !pTab || db->mallocFailed ) goto exit_create_index;
  2405   2405       assert( db->aDb[iDb].pSchema==pTab->pSchema );
  2406   2406     }else{
  2407   2407       assert( pName==0 );
  2408   2408       pTab = pParse->pNewTable;
  2409   2409       if( !pTab ) goto exit_create_index;
  2410   2410       iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  2411   2411     }

Changes to test/attachmalloc.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH statement and
    13     13   # specifically out-of-memory conditions within that command.
    14     14   #
    15         -# $Id: attachmalloc.test,v 1.9 2008/08/04 20:13:27 drh Exp $
           15  +# $Id: attachmalloc.test,v 1.10 2008/10/22 10:45:38 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   ifcapable !memdebug||!attach {
    22     22     finish_test
................................................................................
    41     41     ATTACH 'test2.db' AS two;
    42     42     CREATE TABLE two.t1(x);
    43     43     ATTACH 'test3.db' AS three;
    44     44     CREATE TABLE three.t1(x);
    45     45     ATTACH 'test4.db' AS four;
    46     46     CREATE TABLE four.t1(x);
    47     47   }
           48  +
           49  +do_malloc_test attachmalloc-2 -tclprep {
           50  +  file delete -force test2.db
           51  +  file delete -force test2.db-journal
           52  +  sqlite3 db2 test2.db
           53  +  db2 eval {
           54  +    CREATE TABLE t1(a, b, c);
           55  +    CREATE INDEX i1 ON t1(a, b);
           56  +  }
           57  +  db2 close
           58  +} -sqlbody {
           59  +  CREATE TABLE t1(d, e, f);
           60  +  ATTACH 'test2.db' AS db1;
           61  +}
    48     62   
    49     63   finish_test