summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_misc.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2007-10-09 07:25:24 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2007-10-09 07:25:24 (GMT)
commit7d9c00ec4f8f8347c91fd60ae4eab032e385234b (patch)
tree5b2419948a480b94c376bab819a3db2dff6a8bcc /Lib/bsddb/test/test_misc.py
parent381e1a46cd782bc2090c3f718b34682e06380bbd (diff)
downloadcpython-7d9c00ec4f8f8347c91fd60ae4eab032e385234b.zip
cpython-7d9c00ec4f8f8347c91fd60ae4eab032e385234b.tar.gz
cpython-7d9c00ec4f8f8347c91fd60ae4eab032e385234b.tar.bz2
Backport 58385 from trunk: fix a double free bug in the _bsddb module
on DBCursor.get (and a friends) when passing in a string key.
Diffstat (limited to 'Lib/bsddb/test/test_misc.py')
-rw-r--r--Lib/bsddb/test/test_misc.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/bsddb/test/test_misc.py b/Lib/bsddb/test/test_misc.py
index 88f700b..e7df4a8 100644
--- a/Lib/bsddb/test/test_misc.py
+++ b/Lib/bsddb/test/test_misc.py
@@ -52,6 +52,26 @@ class MiscTestCase(unittest.TestCase):
rp = repr(db)
self.assertEquals(rp, "{}")
+ # http://sourceforge.net/tracker/index.php?func=detail&aid=1708868&group_id=13900&atid=313900
+ #
+ # See the bug report for details.
+ #
+ # The problem was that make_key_dbt() was not allocating a copy of
+ # string keys but FREE_DBT() was always being told to free it when the
+ # database was opened with DB_THREAD.
+ def test04_double_free_make_key_dbt(self):
+ try:
+ db1 = db.DB()
+ db1.open(self.filename, None, db.DB_BTREE,
+ db.DB_CREATE | db.DB_THREAD)
+
+ curs = db1.cursor()
+ t = curs.get("/foo", db.DB_SET)
+ # double free happened during exit from DBC_get
+ finally:
+ db1.close()
+ os.unlink(self.filename)
+
#----------------------------------------------------------------------