mirror of
https://github.com/python/cpython.git
synced 2025-08-19 08:11:46 +00:00
fix issue2858: potential memory corruption when any of the bsddb.db.*
constructors raised an exception. backportes from trunk c63403.
This commit is contained in:
parent
09d374fd67
commit
0812de63c2
2 changed files with 8 additions and 7 deletions
|
@ -89,6 +89,9 @@ Extension Modules
|
||||||
- zlib.decompressobj().flush(value) no longer crashes the interpreter when
|
- zlib.decompressobj().flush(value) no longer crashes the interpreter when
|
||||||
passed a value less than or equal to zero.
|
passed a value less than or equal to zero.
|
||||||
|
|
||||||
|
- issue2858: Fix potential memory corruption when bsddb.db.DBEnv.lock_get
|
||||||
|
and other bsddb.db object constructors raised an exception.
|
||||||
|
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|
|
@ -834,7 +834,7 @@ newDBObject(DBEnvObject* arg, int flags)
|
||||||
Py_DECREF(self->myenvobj);
|
Py_DECREF(self->myenvobj);
|
||||||
self->myenvobj = NULL;
|
self->myenvobj = NULL;
|
||||||
}
|
}
|
||||||
PyObject_Del(self);
|
Py_DECREF(self);
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -955,7 +955,7 @@ newDBEnvObject(int flags)
|
||||||
err = db_env_create(&self->db_env, flags);
|
err = db_env_create(&self->db_env, flags);
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
if (makeDBError(err)) {
|
if (makeDBError(err)) {
|
||||||
PyObject_Del(self);
|
Py_DECREF(self);
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1004,8 +1004,7 @@ newDBTxnObject(DBEnvObject* myenv, DB_TXN *parent, int flags)
|
||||||
#endif
|
#endif
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
if (makeDBError(err)) {
|
if (makeDBError(err)) {
|
||||||
Py_DECREF(self->env);
|
Py_DECREF(self);
|
||||||
PyObject_Del(self);
|
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -1062,7 +1061,7 @@ newDBLockObject(DBEnvObject* myenv, u_int32_t locker, DBT* obj,
|
||||||
#endif
|
#endif
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
if (makeDBError(err)) {
|
if (makeDBError(err)) {
|
||||||
PyObject_Del(self);
|
Py_DECREF(self);
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,8 +1102,7 @@ newDBSequenceObject(DBObject* mydb, int flags)
|
||||||
err = db_sequence_create(&self->sequence, self->mydb->db, flags);
|
err = db_sequence_create(&self->sequence, self->mydb->db, flags);
|
||||||
MYDB_END_ALLOW_THREADS;
|
MYDB_END_ALLOW_THREADS;
|
||||||
if (makeDBError(err)) {
|
if (makeDBError(err)) {
|
||||||
Py_DECREF(self->mydb);
|
Py_DECREF(self);
|
||||||
PyObject_Del(self);
|
|
||||||
self = NULL;
|
self = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue