]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40955: Fix memory leak in subprocess module (GH-20825)
authorChristian Heimes <christian@python.org>
Fri, 12 Jun 2020 16:18:43 +0000 (18:18 +0200)
committerGitHub <noreply@github.com>
Fri, 12 Jun 2020 16:18:43 +0000 (09:18 -0700)
```
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>
Misc/NEWS.d/next/Library/2020-06-12-11-55-30.bpo-40955.huixCg.rst [new file with mode: 0644]
Modules/_posixsubprocess.c

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 (file)
index 0000000..9a98030
--- /dev/null
@@ -0,0 +1 @@
+Fix a minor memory leak in :mod:`subprocess` module when extra_groups was specified.
index add2962189b1c8807f29479cb2a4a16a4352ae0a..5d1691ace4192003a1449749998e3732fc83fc44 100644 (file)
@@ -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);