diff options
author | Jesus Cea <jcea@jcea.es> | 2008-09-03 17:50:32 (GMT) |
---|---|---|
committer | Jesus Cea <jcea@jcea.es> | 2008-09-03 17:50:32 (GMT) |
commit | ac25fab12f95374cad4f11bbcbe5543183b98aa6 (patch) | |
tree | 74b95a3ebb7eea662c4fee826021e774bfe2dd46 /Modules/_bsddb.c | |
parent | b339b2aa6f722cd81f374a6dca62f862caa42748 (diff) | |
download | cpython-ac25fab12f95374cad4f11bbcbe5543183b98aa6.zip cpython-ac25fab12f95374cad4f11bbcbe5543183b98aa6.tar.gz cpython-ac25fab12f95374cad4f11bbcbe5543183b98aa6.tar.bz2 |
Fix some leaks - Neal Norwitz
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 9e89273..9324d76 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -1106,7 +1106,7 @@ DBEnv_dealloc(DBEnvObject* self) { PyObject *dummy; - if (self->db_env && !self->closed) { + if (self->db_env) { dummy=DBEnv_close_internal(self,0); Py_XDECREF(dummy); } @@ -3981,13 +3981,15 @@ DBEnv_close_internal(DBEnvObject* self, int flags) dummy=DB_close_internal(self->children_dbs,0); Py_XDECREF(dummy); } + } + self->closed = 1; + if (self->db_env) { MYDB_BEGIN_ALLOW_THREADS; err = self->db_env->close(self->db_env, flags); MYDB_END_ALLOW_THREADS; /* after calling DBEnv->close, regardless of error, this DBEnv * may not be accessed again (Berkeley DB docs). */ - self->closed = 1; self->db_env = NULL; RETURN_IF_ERR(); } @@ -6148,7 +6150,7 @@ DBSequence_open(DBSequenceObject* self, PyObject* args, PyObject* kwargs) err = self->sequence->open(self->sequence, txn, &key, flags); MYDB_END_ALLOW_THREADS - CLEAR_DBT(key); + FREE_DBT(key); RETURN_IF_ERR(); if (txn) { |