summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:14:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:14:04 (GMT)
commit98a9722e4a82b5f7dc0411233bbec892a02c7667 (patch)
tree51179bb7d80e822a18d0ccbb41fde7198f424813 /Mac
parent2cfae9b03f706e0d6889dfecc21f87419d926b00 (diff)
downloadcpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.zip
cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.gz
cpython-98a9722e4a82b5f7dc0411233bbec892a02c7667.tar.bz2
Issue #20437: Fixed 43 potential bugs when deleting objects references.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/carbonevt/_CarbonEvtmodule.c3
-rw-r--r--Mac/Modules/list/_Listmodule.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/Mac/Modules/carbonevt/_CarbonEvtmodule.c b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
index 623a3e5..30d40c9 100644
--- a/Mac/Modules/carbonevt/_CarbonEvtmodule.c
+++ b/Mac/Modules/carbonevt/_CarbonEvtmodule.c
@@ -1051,8 +1051,7 @@ static PyObject *EventHandlerRef_RemoveEventHandler(EventHandlerRefObject *_self
_err = RemoveEventHandler(_self->ob_itself);
if (_err != noErr) return PyMac_Error(_err);
_self->ob_itself = NULL;
- Py_DECREF(_self->ob_callback);
- _self->ob_callback = NULL;
+ Py_CLEAR(_self->ob_callback);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
diff --git a/Mac/Modules/list/_Listmodule.c b/Mac/Modules/list/_Listmodule.c
index 3f43b06..9e63686 100644
--- a/Mac/Modules/list/_Listmodule.c
+++ b/Mac/Modules/list/_Listmodule.c
@@ -76,8 +76,7 @@ int ListObj_Convert(PyObject *v, ListHandle *p_itself)
static void ListObj_dealloc(ListObject *self)
{
- Py_XDECREF(self->ob_ldef_func);
- self->ob_ldef_func = NULL;
+ Py_CLEAR(self->ob_ldef_func);
SetListRefCon(self->ob_itself, (long)0);
if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself);
self->ob_type->tp_free((PyObject *)self);