From 6c0d4587d4e13d7d870b222498747bf431421eb2 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 12 Jun 2020 11:58:02 +0200 Subject: [PATCH 1/2] bpo-40955: Fix memory leak in subprocess module ``` Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x7f008bf19667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667) #1 0x7f007a0bee4a in subprocess_fork_exec /home/heimes/dev/python/cpython/Modules/_posixsubprocess.c:774 #2 0xe0305b in cfunction_call Objects/methodobject.c:546 ``` Signed-off-by: Christian Heimes --- .../NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst | 1 + Modules/_posixsubprocess.c | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst 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..7f1632a7778728 --- /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 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); From 604a681c66ee252fba3f4f325afe5ff3efd1eb81 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Fri, 12 Jun 2020 08:00:25 -0700 Subject: [PATCH 2/2] add more details to NEWS --- .../next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 7f1632a7778728..9a9803044ec96f 100644 --- 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 @@ -1 +1 @@ -Fix a minor memory leak in :mod:`subprocess` module +Fix a minor memory leak in :mod:`subprocess` module when extra_groups was specified.