From c3f6bdc332d23588102eba749a5929dd5bb67c9d Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 16 Nov 2019 14:26:54 -0800 Subject: [PATCH] bpo-38823: Clean up refleaks in _asyncio initialization. (GH-17195) https://bugs.python.org/issue38823 --- Modules/_asynciomodule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 5e1bcfbde24..aa46e3cf564 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -3387,24 +3387,28 @@ PyInit__asyncio(void) Py_INCREF(&FutureType); if (PyModule_AddObject(m, "Future", (PyObject *)&FutureType) < 0) { Py_DECREF(&FutureType); + Py_DECREF(m); return NULL; } Py_INCREF(&TaskType); if (PyModule_AddObject(m, "Task", (PyObject *)&TaskType) < 0) { Py_DECREF(&TaskType); + Py_DECREF(m); return NULL; } Py_INCREF(all_tasks); if (PyModule_AddObject(m, "_all_tasks", all_tasks) < 0) { Py_DECREF(all_tasks); + Py_DECREF(m); return NULL; } Py_INCREF(current_tasks); if (PyModule_AddObject(m, "_current_tasks", current_tasks) < 0) { Py_DECREF(current_tasks); + Py_DECREF(m); return NULL; }