Commit c8df5780 authored by Raymond Hettinger's avatar Raymond Hettinger

Sf patch #700047: unicode object leaks refcount on resizing

Contributed by Hye-Shik Chang.
parent 5284b447
...@@ -276,6 +276,7 @@ int PyUnicode_Resize(PyObject **unicode, ...@@ -276,6 +276,7 @@ int PyUnicode_Resize(PyObject **unicode,
return -1; return -1;
Py_UNICODE_COPY(w->str, v->str, Py_UNICODE_COPY(w->str, v->str,
length < v->length ? length : v->length); length < v->length ? length : v->length);
Py_DECREF(*unicode);
*unicode = (PyObject *)w; *unicode = (PyObject *)w;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment