Created attachment 6018 [details]
HTML report showing the execution paths that leak memory
See the attached HTML report from gcc-python-plugin's cpychecker.
It looks like a reference count on "*item" is leaked for each time through the loop in compute_enum_values().
a successful call to PySequence_GetItem() is meant to give the caller ownership of a reference count on the returned PyObject*
Double-checking with Python's Objects/abstract.c:
PySequence_GetItem(PyObject *s, Py_ssize_t i)
[... setup and error handling ...]
return m->sq_item(s, i);
and looking at e.g. Objects/listobject.c: list_item (the sq_item callback for PyList_Type): it Py_INCREFs the returned item.
Hence I believe that cpychecker is correctly reporting a memory leak here (for both the case of a successful execution of compute_enum_values(), and the failure path it shows).
I fixed this a while back without realizing there was a PR:
2013-05-20 Tom Tromey <email@example.com>
* python/py-param.c (compute_enum_values): Decref 'item'.