diff options
author | Guido van Rossum <guido@python.org> | 2007-07-12 07:53:00 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-12 07:53:00 (GMT) |
commit | e7a0d3997846155e1a9dcd95eb559039da34ee08 (patch) | |
tree | 53e7fcc4736ebf9dc57b3099abac613a2eef3b12 /Objects | |
parent | dc09715d0bb43a8e7d0a33486e3f07976309df12 (diff) | |
download | cpython-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.c | 5 |
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; } |