[Python-checkins] cpython: Fix memory leak in pyexpat PyUnknownEncodingHandler

Serhiy Storchaka storchaka at gmail.com
Sat Jun 29 23:50:00 CEST 2013


30.06.13 00:43, Serhiy Storchaka написав(ла):
> 29.06.13 22:51, Christian Heimes написав(ла):
>> 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().
>>
>
> Oh, there is yet one blindly inherited bug. Should be:
>
>      if (u == NULL || !PyUnicode_READY(u)) {

Oh, no, I were wrong. PyUnicode_READY() returns false (0) on success and 
true (-1) on fail.




More information about the Python-checkins mailing list