https://github.com/python/cpython/commit/633853004c5b20827872a32e99cebef52ae0f531
commit: 633853004c5b20827872a32e99cebef52ae0f531
branch: main
author: Sergey Miryanov <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-02-12T21:12:07Z
summary:

gh-130050: Fix memory leaks in _testexternalinspection (#130051)

files:
M Modules/_testexternalinspection.c

diff --git a/Modules/_testexternalinspection.c 
b/Modules/_testexternalinspection.c
index 22074c81b7405f..f1e331fea475c4 100644
--- a/Modules/_testexternalinspection.c
+++ b/Modules/_testexternalinspection.c
@@ -778,6 +778,7 @@ parse_coro_chain(
     }
 
     if (PyList_Append(render_to, name)) {
+        Py_DECREF(name);
         return -1;
     }
     Py_DECREF(name);
@@ -955,7 +956,6 @@ parse_task(
     if (PyList_Append(render_to, result)) {
         goto err;
     }
-    Py_DECREF(result);
 
     PyObject *awaited_by = PyList_New(0);
     if (awaited_by == NULL) {
@@ -973,6 +973,7 @@ parse_task(
     ) {
         goto err;
     }
+    Py_DECREF(result);
 
     return 0;
 
@@ -1527,6 +1528,7 @@ get_async_stack_trace(PyObject* self, PyObject* args)
     }
     PyObject* calls = PyList_New(0);
     if (calls == NULL) {
+        Py_DECREF(result);
         return NULL;
     }
     if (PyList_SetItem(result, 0, calls)) { /* steals ref to 'calls' */

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to