Message336859
Coverity scan on python2 resulted in this error.
Python-2.7.15/Modules/_ctypes/cfield.c:1297: alloc_fn: Storage is returned from allocation function "PyString_FromString".
Python-2.7.15/Objects/stringobject.c:143:5: alloc_fn: Storage is returned from allocation function "PyObject_Malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: alloc_fn: Storage is returned from allocation function "malloc".
Python-2.7.15/Objects/obmalloc.c:982:5: return_alloc_fn: Directly returning storage allocated by "malloc".
Python-2.7.15/Objects/stringobject.c:143:5: var_assign: Assigning: "op" = "PyObject_Malloc(37UL + size)".
Python-2.7.15/Objects/stringobject.c:164:5: return_alloc: Returning allocated memory "op".
Python-2.7.15/Modules/_ctypes/cfield.c:1297: var_assign: Assigning: "result" = storage returned from "PyString_FromString((char *)ptr)".
Python-2.7.15/Modules/_ctypes/cfield.c:1311: leaked_storage: Variable "result" going out of scope leaks the storage it points to.
1309| } else
1310| /* cannot shorten the result */
1311|-> return PyString_FromStringAndSize(ptr, size);
1312| }
1313|
This was fixed on python3 with https://github.com/python/cpython/commit/19b52545df898ec911c44e29f75badb902924c0b
Partially backporting this change for this file should fix the issue. |
|
Date |
User |
Action |
Args |
2019-02-28 18:03:20 | cstratak | set | recipients:
+ cstratak, vstinner |
2019-02-28 18:03:20 | cstratak | set | messageid: <1551377000.6.0.726806174953.issue36147@roundup.psfhosted.org> |
2019-02-28 18:03:20 | cstratak | link | issue36147 messages |
2019-02-28 18:03:20 | cstratak | create | |
|