Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f393fc6 commit 35c38eaCopy full SHA for 35c38ea
1 file changed
Modules/_bsddb.c
@@ -774,7 +774,14 @@ DBCursor_dealloc(DBCursorObject* self)
774
int err;
775
if (self->dbc != NULL) {
776
MYDB_BEGIN_ALLOW_THREADS;
777
- if (self->mydb->db != NULL)
+ /* If the underlying database has been closed, we don't
778
+ need to do anything. If the environment has been closed
779
+ we need to leak, as BerkeleyDB will crash trying to access
780
+ the environment. There was an exception when the
781
+ user closed the environment even though there still was
782
+ a database open. */
783
+ if (self->mydb->db && self->mydb->myenvobj &&
784
+ !self->mydb->myenvobj->closed)
785
err = self->dbc->c_close(self->dbc);
786
self->dbc = NULL;
787
MYDB_END_ALLOW_THREADS;
0 commit comments