Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)
(cherry picked from commit 321def8)

Co-authored-by: Ben Harper <btharper1221@gmail.com>
  • Loading branch information
btharper authored and miss-islington committed Oct 7, 2019
commit 855c4f90d8a1d25ab76f993bdd876ac53a16d3f1
7 changes: 7 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static PyObject *asyncio_task_repr_info_func;
static PyObject *asyncio_InvalidStateError;
static PyObject *asyncio_CancelledError;
static PyObject *context_kwname;
static int module_initialized;

static PyObject *cached_running_holder;
static volatile uint64_t cached_running_holder_tsid;
Expand Down Expand Up @@ -3254,6 +3255,12 @@ module_init(void)
if (asyncio_mod == NULL) {
goto fail;
}
if (module_initialized != 0) {
return 0;
}
else {
module_initialized = 1;
}

current_tasks = PyDict_New();
if (current_tasks == NULL) {
Expand Down