diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-05-17 06:46:39 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-05-17 06:46:39 (GMT) |
commit | 0812de63c29c144fd68165ae929b9765656fc7b3 (patch) | |
tree | e9ea0df019c7bff6d0f2255513554a5f84209c0e /Modules | |
parent | 09d374fd670e5ee4e72994f6c1d55ea77e95845e (diff) | |
download | cpython-0812de63c29c144fd68165ae929b9765656fc7b3.zip cpython-0812de63c29c144fd68165ae929b9765656fc7b3.tar.gz cpython-0812de63c29c144fd68165ae929b9765656fc7b3.tar.bz2 |
fix issue2858: potential memory corruption when any of the bsddb.db.*
constructors raised an exception. backportes from trunk c63403.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_bsddb.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 4cedc98..9c9a6b3 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -834,7 +834,7 @@ newDBObject(DBEnvObject* arg, int flags) Py_DECREF(self->myenvobj); self->myenvobj = NULL; } - PyObject_Del(self); + Py_DECREF(self); self = NULL; } return self; @@ -955,7 +955,7 @@ newDBEnvObject(int flags) err = db_env_create(&self->db_env, flags); MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - PyObject_Del(self); + Py_DECREF(self); self = NULL; } else { @@ -1004,8 +1004,7 @@ newDBTxnObject(DBEnvObject* myenv, DB_TXN *parent, int flags) #endif MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - Py_DECREF(self->env); - PyObject_Del(self); + Py_DECREF(self); self = NULL; } return self; @@ -1062,7 +1061,7 @@ newDBLockObject(DBEnvObject* myenv, u_int32_t locker, DBT* obj, #endif MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - PyObject_Del(self); + Py_DECREF(self); self = NULL; } @@ -1103,8 +1102,7 @@ newDBSequenceObject(DBObject* mydb, int flags) err = db_sequence_create(&self->sequence, self->mydb->db, flags); MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - Py_DECREF(self->mydb); - PyObject_Del(self); + Py_DECREF(self); self = NULL; } |