summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:46:20 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-09 11:46:20 (GMT)
commitdfe98a102ec8723d750f78ecda08a7adb9360eb1 (patch)
treef8aea8fb3d74be18ed67a2f4e0a355ad9beb42d8 /Objects/unicodeobject.c
parent2623c8c23cead505a78ec416072223552e94727e (diff)
parent505ff755d704c73ac613d3e8fed02c79c6ae555a (diff)
downloadcpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.zip
cpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.tar.gz
cpython-dfe98a102ec8723d750f78ecda08a7adb9360eb1.tar.bz2
Issue #20437: Fixed 22 potential bugs when deleting objects references.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index eae4bc5..994c4f5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1902,8 +1902,7 @@ _PyUnicode_ClearStaticStrings()
{
_Py_Identifier *tmp, *s = static_strings;
while (s) {
- Py_DECREF(s->object);
- s->object = NULL;
+ Py_CLEAR(s->object);
tmp = s->next;
s->next = NULL;
s = tmp;
@@ -4005,8 +4004,7 @@ make_decode_exception(PyObject **exceptionObject,
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
#ifdef HAVE_MBCS
@@ -6366,8 +6364,7 @@ make_encode_exception(PyObject **exceptionObject,
goto onError;
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
}
@@ -8410,8 +8407,7 @@ make_translate_exception(PyObject **exceptionObject,
goto onError;
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
}
@@ -13502,8 +13498,7 @@ _PyUnicodeWriter_Finish(_PyUnicodeWriter *writer)
PyObject *newbuffer;
newbuffer = resize_compact(writer->buffer, writer->pos);
if (newbuffer == NULL) {
- Py_DECREF(writer->buffer);
- writer->buffer = NULL;
+ Py_CLEAR(writer->buffer);
return NULL;
}
writer->buffer = newbuffer;