sl@0: # 2006 July 26 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file contains additional out-of-memory checks (see malloc.tcl) sl@0: # added to expose a bug in out-of-memory handling for sqlite3_prepare16(). sl@0: # sl@0: # $Id: malloc7.test,v 1.5 2008/02/18 22:24:58 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: source $testdir/malloc_common.tcl sl@0: sl@0: # Only run these tests if memory debugging is turned on. sl@0: # sl@0: if {!$MEMDEBUG} { sl@0: puts "Skipping malloc7 tests: not compiled with -DSQLITE_MEMDEBUG..." sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: sl@0: do_malloc_test malloc7-1 -sqlprep { sl@0: CREATE TABLE t1(a,b,c,d); sl@0: CREATE INDEX i1 ON t1(b,c); sl@0: } -tclbody { sl@0: set sql16 [encoding convertto unicode "SELECT * FROM sqlite_master"] sl@0: append sql16 "\00\00" sl@0: set nbyte [string length $sql16] sl@0: set ::STMT [sqlite3_prepare16 db $sql16 $nbyte DUMMY] sl@0: sqlite3_finalize $::STMT sl@0: } sl@0: sl@0: sl@0: # Ensure that no file descriptors were leaked. sl@0: do_test malloc-99.X { sl@0: catch {db close} sl@0: set sqlite_open_file_count sl@0: } {0} sl@0: sl@0: puts open-file-count=$sqlite_open_file_count sl@0: finish_test