bpo-40955: Fix memory leak in subprocess module (GH-20825)

```
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    GH-0 0x7f008bf19667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    GH-1 0x7f007a0bee4a in subprocess_fork_exec /home/heimes/dev/python/cpython/Modules/_posixsubprocess.c:774
    GH-2 0xe0305b in cfunction_call Objects/methodobject.c:546
```

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 0d3350daa8)

Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
Miss Islington (bot) 2020-06-12 10:02:45 -07:00 committed by GitHub
parent 2c0a59bb3d
commit ee3f7fee94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix a minor memory leak in :mod:`subprocess` module when extra_groups was specified.

View 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);