diff --git a/Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst b/Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst new file mode 100644 index 00000000000000..9a9803044ec96f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst @@ -0,0 +1 @@ +Fix a minor memory leak in :mod:`subprocess` module when extra_groups was specified. diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index add2962189b1c8..5d1691ace41920 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -893,6 +893,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args) if (_enable_gc(need_to_reenable_gc, gc_module)) { pid = -1; } + PyMem_RawFree(groups); Py_XDECREF(preexec_fn_args_tuple); Py_XDECREF(gc_module);