[Python-checkins] r63404 - in python/branches/release25-maint: Misc/NEWS Modules/_bsddb.c

gregory.p.smith python-checkins at python.org
Sat May 17 08:46:40 CEST 2008


Author: gregory.p.smith
Date: Sat May 17 08:46:39 2008
New Revision: 63404

Log:
fix issue2858: potential memory corruption when any of the bsddb.db.*
constructors raised an exception.  backportes from trunk c63403.


Modified:
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/Modules/_bsddb.c

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Sat May 17 08:46:39 2008
@@ -89,6 +89,9 @@
 - zlib.decompressobj().flush(value) no longer crashes the interpreter when
   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
 -----
 

Modified: python/branches/release25-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release25-maint/Modules/_bsddb.c	(original)
+++ python/branches/release25-maint/Modules/_bsddb.c	Sat May 17 08:46:39 2008
@@ -834,7 +834,7 @@
             Py_DECREF(self->myenvobj);
             self->myenvobj = NULL;
         }
-        PyObject_Del(self);
+        Py_DECREF(self);
         self = NULL;
     }
     return self;
@@ -955,7 +955,7 @@
     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 @@
 #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 @@
 #endif
     MYDB_END_ALLOW_THREADS;
     if (makeDBError(err)) {
-        PyObject_Del(self);
+        Py_DECREF(self);
         self = NULL;
     }
 
@@ -1103,8 +1102,7 @@
     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;
     }
 


More information about the Python-checkins mailing list