]> granicus.if.org Git - python/commitdiff
fixes pybsddb SF bug id 1215432. DB.associate() would crash when a
authorGregory P. Smith <greg@mad-scientist.com>
Mon, 6 Jun 2005 09:55:06 +0000 (09:55 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Mon, 6 Jun 2005 09:55:06 +0000 (09:55 +0000)
DBError was supposed to be raised.

needs backport to 2.4.x and possibly 2.3.x.

Modules/_bsddb.c

index 3858e26a2433c80cdc9c399c96bc3abf1ef600ab..12bb76823f9dab3ed622296b6c05bbc7c5e38325 100644 (file)
@@ -1181,9 +1181,7 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
     }
 
     /* Save a reference to the callback in the secondary DB. */
-    if (self->associateCallback != NULL) {
-        Py_DECREF(self->associateCallback);
-    }
+    Py_XDECREF(secondaryDB->associateCallback);
     Py_INCREF(callback);
     secondaryDB->associateCallback = callback;
     secondaryDB->primaryDBType = _DB_get_type(self);
@@ -1217,8 +1215,8 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs)
     MYDB_END_ALLOW_THREADS;
 
     if (err) {
-        Py_DECREF(self->associateCallback);
-        self->associateCallback = NULL;
+        Py_XDECREF(secondaryDB->associateCallback);
+        secondaryDB->associateCallback = NULL;
         secondaryDB->primaryDBType = 0;
     }