mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Make sure SQLITE_NOMEM is reported out on a malloc failure in an ATTACH
even if the malloc failure reports within a nested calls to sqlite3_prepare(). (CVS 3164) FossilOrigin-Name: 3538a4e30fb5131b461bb0cf72cada63e9724e14
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
# special feature is used to see what happens in the library if a malloc
|
||||
# were to really fail due to an out-of-memory situation.
|
||||
#
|
||||
# $Id: malloc.test,v 1.30 2006/01/24 10:58:23 danielk1977 Exp $
|
||||
# $Id: malloc.test,v 1.31 2006/04/05 11:57:37 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -513,6 +513,26 @@ do_malloc_test 19 -tclprep {
|
||||
}
|
||||
unset static_string
|
||||
|
||||
# Make sure SQLITE_NOMEM is reported out on an ATTACH failure even
|
||||
# when the malloc failure occurs within the nested parse.
|
||||
#
|
||||
do_malloc_test 20 -tclprep {
|
||||
db close
|
||||
file delete -force test2.db test2.db-journal
|
||||
sqlite3 db test2.db
|
||||
db eval {CREATE TABLE t1(x);}
|
||||
db close
|
||||
} -tclbody {
|
||||
if {[catch {sqlite3 db test.db}]} {
|
||||
error "out of memory"
|
||||
}
|
||||
} -sqlbody {
|
||||
ATTACH DATABASE 'test2.db' AS t2;
|
||||
SELECT * FROM t1;
|
||||
DETACH DATABASE t2;
|
||||
}
|
||||
|
||||
|
||||
# Ensure that no file descriptors were leaked.
|
||||
do_test malloc-99.X {
|
||||
catch {db close}
|
||||
|
Reference in New Issue
Block a user