Re: [Python-Dev] [Python-checkins] cpython: Fix memory leak in pyexpat PyUnknownEncodingHandler
I don't know if this is the commit at fault or not, but we are seeing
segfaults in test_xml_etree on the buildbots now.
--David
On Sat, 29 Jun 2013 20:43:22 +0200, christian.heimes
http://hg.python.org/cpython/rev/bd0834b59828 changeset: 84375:bd0834b59828 user: Christian Heimes
date: Sat Jun 29 20:43:13 2013 +0200 summary: Fix memory leak in pyexpat PyUnknownEncodingHandler CID 1040367 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable u going out of scope leaks the storage it points to. files: Modules/pyexpat.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1128,8 +1128,10 @@ }
u = PyUnicode_Decode((char*) template_buffer, 256, name, "replace"); - if (u == NULL || PyUnicode_READY(u)) + if (u == NULL || PyUnicode_READY(u)) { + Py_DECREF(u); return XML_STATUS_ERROR; + }
if (PyUnicode_GET_LENGTH(u) != 256) { Py_DECREF(u);
-- Repository URL: http://hg.python.org/cpython _______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
Am 29.06.2013 21:29, schrieb R. David Murray:
I don't know if this is the commit at fault or not, but we are seeing segfaults in test_xml_etree on the buildbots now.
Yeah, it's my fault. Thanks!
u = PyUnicode_Decode((char*) template_buffer, 256, name, "replace"); - if (u == NULL || PyUnicode_READY(u))wr + Py_DECREF(u); return XML_STATUS_ERROR; + }
Py_DECREF() is wrong as u can be NULL. I have changed the code to use Py_XDECREF().
participants (2)
-
Christian Heimes
-
R. David Murray