1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a memory leak in the parser that can occur following a malloc failure. (CVS 4071)

FossilOrigin-Name: d0b6e9a07e99cc1a7d7f61877918c9a247899996
This commit is contained in:
drh
2007-06-15 17:03:14 +00:00
parent edaaec223c
commit 43b788260e
4 changed files with 17 additions and 14 deletions

View File

@ -12,7 +12,7 @@
#
# 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
@ -25,11 +25,10 @@ if {[info command sqlite_malloc_stat]==""} {
return
}
source $testdir/fuzz_common.tcl
source $testdir/malloc_common.tcl
set ::REPEATS 20
set ::REPEATS 40
#
# Usage: do_fuzzy_malloc_test <testname> ?<options>?
@ -49,8 +48,10 @@ proc do_fuzzy_malloc_test {testname args} {
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} {