Skip to content

Commit ee3f7fe

Browse files
bpo-40955: Fix memory leak in subprocess module (pythonGH-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 <[email protected]> (cherry picked from commit 0d3350d) Co-authored-by: Christian Heimes <[email protected]>
1 parent 2c0a59b commit ee3f7fe

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a minor memory leak in :mod:`subprocess` module when extra_groups was specified.

Modules/_posixsubprocess.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
893893
if (_enable_gc(need_to_reenable_gc, gc_module)) {
894894
pid = -1;
895895
}
896+
PyMem_RawFree(groups);
896897
Py_XDECREF(preexec_fn_args_tuple);
897898
Py_XDECREF(gc_module);
898899

0 commit comments

Comments
 (0)