summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-12 07:53:00 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-12 07:53:00 (GMT)
commite7a0d3997846155e1a9dcd95eb559039da34ee08 (patch)
tree53e7fcc4736ebf9dc57b3099abac613a2eef3b12 /Objects
parentdc09715d0bb43a8e7d0a33486e3f07976309df12 (diff)
downloadcpython-e7a0d3997846155e1a9dcd95eb559039da34ee08.zip
cpython-e7a0d3997846155e1a9dcd95eb559039da34ee08.tar.gz
cpython-e7a0d3997846155e1a9dcd95eb559039da34ee08.tar.bz2
Fixed a refcount leak in _PyUnicode_AsDefaultEncodedString().
Found by Amaury Forgeot d'Arc, SF# 1752317. (Also removed a redundant check for !errors.)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 47b1d6c..2728f1f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1206,10 +1206,7 @@ PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
v = PyString_FromStringAndSize(PyBytes_AsString(b),
PyBytes_Size(b));
Py_DECREF(b);
- if (!errors) {
- Py_XINCREF(v);
- ((PyUnicodeObject *)unicode)->defenc = v;
- }
+ ((PyUnicodeObject *)unicode)->defenc = v;
return v;
}