Index: src/parse.y ================================================================== --- src/parse.y +++ src/parse.y @@ -12,11 +12,11 @@ ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** -** @(#) $Id: parse.y,v 1.229 2007/05/30 10:36:47 danielk1977 Exp $ +** @(#) $Id: parse.y,v 1.230 2007/06/15 17:03:14 drh Exp $ */ // All token codes are small integers with #defines that begin with "TK_" %token_prefix TK_ @@ -379,10 +379,12 @@ %ifndef SQLITE_OMIT_COMPOUND_SELECT select(A) ::= select(X) multiselect_op(Y) oneselect(Z). { if( Z ){ Z->op = Y; Z->pPrior = X; + }else{ + sqlite3SelectDelete(X); } A = Z; } %type multiselect_op {int} multiselect_op(A) ::= UNION(OP). {A = @OP;} Index: test/fuzz_malloc.test ================================================================== --- test/fuzz_malloc.test +++ test/fuzz_malloc.test @@ -10,11 +10,11 @@ # #*********************************************************************** # # This file tests malloc failures in concert with fuzzy SQL generation. # -# $Id: fuzz_malloc.test,v 1.3 2007/06/15 13:57:20 drh Exp $ +# $Id: fuzz_malloc.test,v 1.4 2007/06/15 17:03:15 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Only run these tests if memory debugging is turned on. @@ -23,15 +23,14 @@ puts "Skipping fuzz_malloc tests: not compiled with -DSQLITE_MEMDEBUG=1" finish_test return } - source $testdir/fuzz_common.tcl source $testdir/malloc_common.tcl -set ::REPEATS 20 +set ::REPEATS 40 # # Usage: do_fuzzy_malloc_test ?? # # -template @@ -47,12 +46,14 @@ db close file delete test.db test.db-journal sqlite3 db test.db set ::prep $::fuzzyopts(-sqlprep) execsql $::prep - + set jj 0 for {set ii 0} {$ii < $::fuzzyopts(-repeats)} {incr ii} { + expr srand($jj) + incr jj set ::sql [subst $::fuzzyopts(-template)] foreach {rc res} [catchsql "$::sql"] {} if {$rc==0} { do_malloc_test $testname-$ii -sqlbody $::sql -sqlprep $::prep } else {