projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3402f72
)
bpo-30602: Fix refleak in os.spawnve() (#2184)
author
Victor Stinner
<victor.stinner@gmail.com>
Wed, 14 Jun 2017 12:26:21 +0000
(14:26 +0200)
committer
GitHub
<noreply@github.com>
Wed, 14 Jun 2017 12:26:21 +0000
(14:26 +0200)
When os.spawnve() fails while handling arguments, free correctly
argvlist: pass lastarg+1 rather than lastarg to free_string_array()
to also free the first item.
Modules/posixmodule.c
patch
|
blob
|
history
diff --git
a/Modules/posixmodule.c
b/Modules/posixmodule.c
index 6b1e435b12985054736d0f9512d532d6fc94f2c1..470702981308e2e65265ecb4c9260c4132b68206 100644
(file)
--- a/
Modules/posixmodule.c
+++ b/
Modules/posixmodule.c
@@
-5223,7
+5223,7
@@
os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
Py_ssize_t argc, i, envc;
intptr_t spawnval;
PyObject *(*getitem)(PyObject *, Py_ssize_t);
- Py_ssize_t lastarg =
0
;
+ Py_ssize_t lastarg =
-1
;
/* spawnve has four arguments: (mode, path, argv, env), where
argv is a list or tuple of strings and env is a dictionary
@@
-5302,7
+5302,7
@@
os_spawnve_impl(PyObject *module, int mode, path_t *path, PyObject *argv,
PyMem_DEL(envlist[envc]);
PyMem_DEL(envlist);
fail_1:
- free_string_array(argvlist, lastarg);
+ free_string_array(argvlist, lastarg
+ 1
);
fail_0:
return res;
}