mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
perf python: Fix memory leak in pyrf_evlist__get_pollfd
Fix a Python list object leak in pyrf_evlist__get_pollfd() by adding
a missing Py_DECREF on the error exit path.
Assisted-by: Antigravity:gemini-3.1-pro
Fixes: 877108e42b ("perf tools: Initial python binding")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
08e96e3c73
commit
38d778acbe
|
|
@ -2825,6 +2825,8 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist,
|
|||
|
||||
evlist = pevlist->evlist;
|
||||
list = PyList_New(0);
|
||||
if (!list)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < evlist__core(evlist)->pollfd.nr; ++i) {
|
||||
PyObject *file;
|
||||
|
|
@ -2843,6 +2845,7 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist,
|
|||
|
||||
return list;
|
||||
free_list:
|
||||
Py_XDECREF(list);
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user