summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-07-19 12:46:12 (GMT)
committerGeorg Brandl <georg@python.org>2008-07-19 12:46:12 (GMT)
commit278fc50c07fcfb90b681c1401eaa9ed40bb1778c (patch)
tree4d07aeaddee59163b28e59820c8d9700682d324f /Modules/_localemodule.c
parent6b41a8e156d7c38947a082016ffb58de8d2485ce (diff)
downloadcpython-278fc50c07fcfb90b681c1401eaa9ed40bb1778c.zip
cpython-278fc50c07fcfb90b681c1401eaa9ed40bb1778c.tar.gz
cpython-278fc50c07fcfb90b681c1401eaa9ed40bb1778c.tar.bz2
#3303: fix crash with invalid Py_DECREF in strcoll().
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 09c025f..bf5d58d 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -301,7 +301,9 @@ PyLocale_strcoll(PyObject* self, PyObject* args)
if (!PyUnicode_Check(os2)) {
os2 = PyUnicode_FromObject(os2);
if (!os2) {
- Py_DECREF(os1);
+ if (rel1) {
+ Py_DECREF(os1);
+ }
return NULL;
}
rel2 = 1;