1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-24 14:17:58 +03:00

Fix a memory leak that can follow an OOM error in a user-function that uses sqlite3_set_auxdata().

FossilOrigin-Name: 0185c4b689d18d66e6aa39b4a7bddc279e3c9d17
This commit is contained in:
dan
2011-06-14 14:18:45 +00:00
parent 79bd81038c
commit 5f84e14add
4 changed files with 30 additions and 17 deletions

View File

@@ -894,6 +894,18 @@ ifcapable stat2&&utf16 {
}
}
# Test that if an OOM error occurs, aux-data is still correctly destroyed.
# This test case was causing either a memory-leak or an assert() failure
# at one point, depending on the configuration.
#
do_malloc_test 39 -tclprep {
sqlite3 db test.db
} -sqlbody {
SELECT test_auxdata('abc', 'def');
} -cleanup {
db close
}
# Ensure that no file descriptors were leaked.
do_test malloc-99.X {
catch {db close}