/ Check-in [097737e3]
Login

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

Overview
Comment:Fix a crash that could occur when creating an index in shared-cache mode with lookaside enabled. (CVS 6358)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:097737e3689b9a7e32815fe9c6fc6eed796ae53c
User & Date: danielk1977 2009-03-18 18:43:36
References
2010-01-05
18:06
Apply fix [097737e368] to the 3.6.1 branch. check-in: 9f819ea6 user: dan tags: branch-3.6.1
Context
2009-03-19
07:58
Change sqlite3_step() to return SQLITE_LOCKED if a statement cannot be re-compiled due to locks on the shared-cache schema. Also add a blocking wrapper of sqlite3_prepare_v2() to the test code. (CVS 6359) check-in: e8be1af9 user: danielk1977 tags: trunk
2009-03-18
18:43
Fix a crash that could occur when creating an index in shared-cache mode with lookaside enabled. (CVS 6358) check-in: 097737e3 user: danielk1977 tags: trunk
13:55
Modify test script backup2.test so that it works on OSX. (CVS 6357) check-in: d82e8cd4 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.523 2009/03/17 17:49:00 danielk1977 Exp $
           25  +** $Id: build.c,v 1.524 2009/03/18 18:43:36 danielk1977 Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   
    29     29   /*
    30     30   ** This routine is called when a new SQL statement is beginning to
    31     31   ** be parsed.  Initialize the pParse structure as needed.
    32     32   */
................................................................................
  2842   2842       }
  2843   2843       pIndex = 0;
  2844   2844     }
  2845   2845   
  2846   2846     /* Clean up before exiting */
  2847   2847   exit_create_index:
  2848   2848     if( pIndex ){
  2849         -    freeIndex(pIndex);
         2849  +    sqlite3_free(pIndex->zColAff);
         2850  +    sqlite3DbFree(db, pIndex);
  2850   2851     }
  2851   2852     sqlite3ExprListDelete(db, pList);
  2852   2853     sqlite3SrcListDelete(db, pTblName);
  2853   2854     sqlite3DbFree(db, zName);
  2854   2855     return;
  2855   2856   }
  2856   2857   

Changes to test/shared2.test.

     5      5   #
     6      6   #    May you do good and not evil.
     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   #
    12         -# $Id: shared2.test,v 1.6 2009/03/17 17:49:00 danielk1977 Exp $
           12  +# $Id: shared2.test,v 1.7 2009/03/18 18:43:36 danielk1977 Exp $
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   db close
    17     17   
    18     18   ifcapable !shared_cache {
    19     19     finish_test
................................................................................
   146    146     execsql { INSERT INTO t1(a) VALUES(1) } db2
   147    147   } {}
   148    148   
   149    149   do_test shared2-4.3 {
   150    150     db2 close
   151    151     db close
   152    152   } {}
          153  +
          154  +# At one point, this was causing a crash.
          155  +#
          156  +do_test shared2-5.1 {
          157  +  sqlite3 db test.db
          158  +  sqlite3 db2 test.db
          159  +  execsql { CREATE TABLE t2(a, b, c) }
          160  +  
          161  +  # The following statement would crash when attempting to sqlite3_free()
          162  +  # a pointer allocated from a lookaside buffer.
          163  +  execsql { CREATE INDEX i1 ON t2(a) } db2
          164  +} {}
          165  +
          166  +db close
          167  +db2 close
   153    168   
   154    169   sqlite3_enable_shared_cache $::enable_shared_cache
   155    170   finish_test
   156    171