Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a786f2b

Browse files
committed
Fix some leaks - Neal Norwitz
1 parent 8951b61 commit a786f2b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Modules/_bsddb.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ DBEnv_dealloc(DBEnvObject* self)
11061106
{
11071107
PyObject *dummy;
11081108

1109-
if (self->db_env && !self->closed) {
1109+
if (self->db_env) {
11101110
dummy=DBEnv_close_internal(self,0);
11111111
Py_XDECREF(dummy);
11121112
}
@@ -3981,13 +3981,15 @@ DBEnv_close_internal(DBEnvObject* self, int flags)
39813981
dummy=DB_close_internal(self->children_dbs,0);
39823982
Py_XDECREF(dummy);
39833983
}
3984+
}
39843985

3986+
self->closed = 1;
3987+
if (self->db_env) {
39853988
MYDB_BEGIN_ALLOW_THREADS;
39863989
err = self->db_env->close(self->db_env, flags);
39873990
MYDB_END_ALLOW_THREADS;
39883991
/* after calling DBEnv->close, regardless of error, this DBEnv
39893992
* may not be accessed again (Berkeley DB docs). */
3990-
self->closed = 1;
39913993
self->db_env = NULL;
39923994
RETURN_IF_ERR();
39933995
}
@@ -6148,7 +6150,7 @@ DBSequence_open(DBSequenceObject* self, PyObject* args, PyObject* kwargs)
61486150
err = self->sequence->open(self->sequence, txn, &key, flags);
61496151
MYDB_END_ALLOW_THREADS
61506152

6151-
CLEAR_DBT(key);
6153+
FREE_DBT(key);
61526154
RETURN_IF_ERR();
61536155

61546156
if (txn) {

Modules/bsddb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
#error "eek! DBVER can't handle minor versions > 9"
106106
#endif
107107

108-
#define PY_BSDDB_VERSION "4.7.3pre3"
108+
#define PY_BSDDB_VERSION "4.7.3pre4"
109109

110110
/* Python object definitions */
111111

0 commit comments

Comments
 (0)