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

Fix a memory leak that can occur in os_unix.c if an IO error occurs within the xUnlock method.

FossilOrigin-Name: 6c5c04eea1f0e8d61883ee8675c249fbf895dc01
This commit is contained in:
dan
2010-06-16 10:55:42 +00:00
parent a4a9095ec0
commit b0ac3e3a17
8 changed files with 247 additions and 69 deletions

View File

@ -109,36 +109,29 @@ proc do_faultsim_test {name args} {
#-------------------------------------------------------------------------
# Procedures to save and restore the current file-system state:
#
# faultsim_save
# faultsim_save_and_close
# faultsim_restore_and_reopen
# faultsim_delete_and_reopen
#
proc faultsim_save_and_close {} {
foreach {a => b} {
test.db => testX.db
test.db-wal => testX.db-wal
test.db-journal => testX.db-journal
} {
if {[file exists $a]} {
file copy -force $a $b
} else {
file delete -force $b
}
proc faultsim_save {} {
foreach f [glob -nocomplain sv_test.db*] { file delete -force $f }
foreach f [glob -nocomplain test.db*] {
set f2 "sv_$f"
file copy -force $f $f2
}
}
proc faultsim_save_and_close {} {
faultsim_save
catch { db close }
return ""
}
proc faultsim_restore_and_reopen {} {
catch { db close }
foreach {a => b} {
testX.db => test.db
testX.db-wal => test.db-wal
testX.db-journal => test.db-journal
} {
if {[file exists $a]} {
file copy -force $a $b
} else {
file delete -force $b
}
foreach f [glob -nocomplain test.db*] { file delete -force $f }
foreach f2 [glob -nocomplain sv_test.db*] {
set f [string range $f2 3 end]
file copy -force $f2 $f
}
sqlite3 db test.db
sqlite3_extended_result_codes db 1
@ -152,7 +145,7 @@ proc faultsim_integrity_check {{db db}} {
proc faultsim_delete_and_reopen {{file test.db}} {
catch { db close }
file delete -force test.db test.db-wal test.db-journal
foreach f [glob -nocomplain test.db*] { file delete -force $f }
sqlite3 db test.db
}