diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-07-15 19:12:54 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-07-15 19:12:54 (GMT) |
commit | 35c38eaeae8d24fe0098f3942135b3ba28cffe85 (patch) | |
tree | 4d00282cc7302924d11ec4574f457b211ff14b1d /Modules/_bsddb.c | |
parent | f393fc6e518deee43922baa7f0255b69472f9d2e (diff) | |
download | cpython-35c38eaeae8d24fe0098f3942135b3ba28cffe85.zip cpython-35c38eaeae8d24fe0098f3942135b3ba28cffe85.tar.gz cpython-35c38eaeae8d24fe0098f3942135b3ba28cffe85.tar.bz2 |
heck environment closed status before closing a cursors. Fixes #763928.
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 227fe7b..990c89f 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -774,7 +774,14 @@ DBCursor_dealloc(DBCursorObject* self) int err; if (self->dbc != NULL) { MYDB_BEGIN_ALLOW_THREADS; - if (self->mydb->db != NULL) + /* 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 + the environment. There was an exception when the + user closed the environment even though there still was + a database open. */ + if (self->mydb->db && self->mydb->myenvobj && + !self->mydb->myenvobj->closed) err = self->dbc->c_close(self->dbc); self->dbc = NULL; MYDB_END_ALLOW_THREADS; |