[Python-checkins] r60545 - in python/branches/release25-maint: Misc/NEWS Modules/_bsddb.c
gregory.p.smith
python-checkins at python.org
Sun Feb 3 08:26:24 CET 2008
Author: gregory.p.smith
Date: Sun Feb 3 08:26:23 2008
New Revision: 60545
Modified:
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Modules/_bsddb.c
Log:
backport r60544 from trunk:
Merge this fix from the pybsddb tree:
r293 | jcea | 2008-01-31 01:08:19 -0800 (Thu, 31 Jan 2008) | 4 lines
Solved memory leak when using cursors with
databases without environment.
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Sun Feb 3 08:26:23 2008
@@ -244,6 +244,9 @@
- Bug #1372: zlibmodule.c: int overflow in PyZlib_decompress
+- bsddb module: Fix memory leak when using database cursors on
+ databases without a DBEnv.
+
Documentation
-------------
Modified: python/branches/release25-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release25-maint/Modules/_bsddb.c (original)
+++ python/branches/release25-maint/Modules/_bsddb.c Sun Feb 3 08:26:23 2008
@@ -913,7 +913,6 @@
#endif
if (self->dbc != NULL) {
- MYDB_BEGIN_ALLOW_THREADS;
/* If the underlying database has been closed, we don't
need to do anything. If the environment has been closed
we need to leak, as BerkeleyDB will crash trying to access
@@ -922,9 +921,14 @@
a database open. */
if (self->mydb->db && self->mydb->myenvobj &&
!self->mydb->myenvobj->closed)
+ /* test for: open db + no environment or non-closed environment */
+ if (self->mydb->db && (!self->mydb->myenvobj || (self->mydb->myenvobj &&
+ !self->mydb->myenvobj->closed))) {
+ MYDB_BEGIN_ALLOW_THREADS;
err = self->dbc->c_close(self->dbc);
+ MYDB_END_ALLOW_THREADS;
+ }
self->dbc = NULL;
- MYDB_END_ALLOW_THREADS;
}
Py_XDECREF( self->mydb );
PyObject_Del(self);
More information about the Python-checkins
mailing list