[issue29034] Fix memory leak in path_converter

Xiang Zhang report at bugs.python.org
Wed Dec 21 09:19:07 EST 2016


Xiang Zhang added the comment:

Hmm, while considering Victor's comment, I find some new:

path->object refers to the original object o, it owns a borrowed reference. But when received a PathLike object, o is assigned the return value of __fspath__ and decrefed at end. So path->object could refer to a already freed object.

And the PyUnicode_AsWideCharString can't be simply replaced with PyUnicode_AsUnicodeAndSize since wo is decrefed and object->wide could then refer to freed memory.

The logic is complex and I get headache reading the code. Did I miss something?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29034>
_______________________________________


More information about the Python-bugs-list mailing list