Skip to content

Commit 6338530

Browse files
gh-130050: Fix memory leaks in _testexternalinspection (#130051)
1 parent 1b27f36 commit 6338530

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_testexternalinspection.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ parse_coro_chain(
778778
}
779779

780780
if (PyList_Append(render_to, name)) {
781+
Py_DECREF(name);
781782
return -1;
782783
}
783784
Py_DECREF(name);
@@ -955,7 +956,6 @@ parse_task(
955956
if (PyList_Append(render_to, result)) {
956957
goto err;
957958
}
958-
Py_DECREF(result);
959959

960960
PyObject *awaited_by = PyList_New(0);
961961
if (awaited_by == NULL) {
@@ -973,6 +973,7 @@ parse_task(
973973
) {
974974
goto err;
975975
}
976+
Py_DECREF(result);
976977

977978
return 0;
978979

@@ -1527,6 +1528,7 @@ get_async_stack_trace(PyObject* self, PyObject* args)
15271528
}
15281529
PyObject* calls = PyList_New(0);
15291530
if (calls == NULL) {
1531+
Py_DECREF(result);
15301532
return NULL;
15311533
}
15321534
if (PyList_SetItem(result, 0, calls)) { /* steals ref to 'calls' */

0 commit comments

Comments
 (0)