summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2020-06-12 18:18:43 +0200
committerGitHub <noreply@github.com>2020-06-12 09:18:43 -0700
commit0d3350daa8123a3e16d4a534b6e873eb12c10d7c (patch)
tree4ff1d791854f753576ebbf23c2ca6322ff766979
parente2fb8a2c42ee60c72a40d93da69e9efc4e359023 (diff)
downloadcpython-git-0d3350daa8123a3e16d4a534b6e873eb12c10d7c.tar.gz
bpo-40955: Fix memory leak in subprocess module (GH-20825)
``` 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 <christian@python.org>
-rw-r--r--Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst1
-rw-r--r--Modules/_posixsubprocess.c1
2 files changed, 2 insertions, 0 deletions
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 0000000000..9a9803044e
--- /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 add2962189..5d1691ace4 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);