Kaydet (Commit) dc5af706 authored tarafından Gregory P. Smith's avatar Gregory P. Smith

SF patch / bug #967763

Fix memory leaks revealed by valgrind and ensuing code inspection.

In the existing test suite valgrind revealed two memory leaks (DB_get
and DBC_set_range).  Code inspection revealed that there were many other
potential similar leaks (many on odd code error paths such as passing
something other than a DBTxn object for a txn= parameter or in the face
of an out of memory error).  The most common case that would cause a
leak was when using recno or queue format databases with integer keys,
sometimes only with an exception exit.
üst c2b151c6
......@@ -133,6 +133,13 @@ class SimpleRecnoTestCase(unittest.TestCase):
if verbose:
print rec
# test that non-existant key lookups work (and that
# DBC_set_range doesn't have a memleak under valgrind)
rec = c.set_range(999999)
assert rec == None
if verbose:
print rec
c.close()
d.close()
......@@ -177,6 +184,8 @@ class SimpleRecnoTestCase(unittest.TestCase):
"""
source = os.path.join(os.path.dirname(sys.argv[0]),
'db_home/test_recno.txt')
if not os.path.isdir('db_home'):
os.mkdir('db_home')
f = open(source, 'w') # create the file
f.close()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment