1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Ensure that the db.mallocFailed flag is cleared before sqlite3_errmsg16() returns. (CVS 5154)

FossilOrigin-Name: 0d47653a3c39b7cd41c7e6edd8c4b4543658412d
This commit is contained in:
danielk1977
2008-05-22 13:56:17 +00:00
parent 80105af21b
commit 131c8bc0c2
5 changed files with 59 additions and 16 deletions

View File

@ -13,7 +13,7 @@
# cache context. What happens to connection B if one connection A encounters
# an IO-error whilst reading or writing the file-system?
#
# $Id: shared_err.test,v 1.18 2008/01/18 17:03:33 drh Exp $
# $Id: shared_err.test,v 1.19 2008/05/22 13:56:17 danielk1977 Exp $
proc skip {args} {}
@ -30,6 +30,7 @@ ifcapable !shared_cache||!subquery {
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
do_ioerr_test shared_ioerr-1 -tclprep {
sqlite3 db2 test.db
execsql {
@ -441,6 +442,7 @@ do_test shared_malloc-8.X {
expr $::aborted>=1
} {1}
# This test is designed to catch a specific bug that was present during
# development of 3.5.0. If a malloc() failed while setting the page-size,
# a buffer (Pager.pTmpSpace) was being freed. This could cause a seg-fault
@ -463,6 +465,41 @@ do_malloc_test shared_err-9 -tclprep {
db2 close
}
catch {db close}
catch {db2 close}
do_malloc_test shared_err-10 -tclprep {
sqlite3 db test.db
sqlite3 db2 test.db
db eval { SELECT * FROM sqlite_master }
db2 eval {
BEGIN;
CREATE TABLE abc(a, b, c);
}
} -tclbody {
catch {db eval {SELECT * FROM sqlite_master}}
error 1
} -cleanup {
execsql { SELECT * FROM sqlite_master }
}
do_malloc_test shared_err-11 -tclprep {
sqlite3 db test.db
sqlite3 db2 test.db
db eval { SELECT * FROM sqlite_master }
db2 eval {
BEGIN;
CREATE TABLE abc(a, b, c);
}
} -tclbody {
catch {db eval {SELECT * FROM sqlite_master}}
catch {sqlite3_errmsg16 db}
error 1
} -cleanup {
execsql { SELECT * FROM sqlite_master }
}
catch {db close}
catch {db2 close}