Kaydet (Commit) b78fbaae authored tarafından Victor Stinner's avatar Victor Stinner Kaydeden (comit) GitHub

bpo-30602: Fix refleak in os.spawnv() (#2212) (#2486)

When os.spawnv() fails while handling arguments, free correctly
argvlist: pass lastarg+1 rather than lastarg to free_string_array()
to also free the first item.
(cherry picked from commit 8acb4cf2)
üst 38d6a408
......@@ -5106,7 +5106,7 @@ os_spawnv_impl(PyObject *module, int mode, path_t *path, PyObject *argv)
return NULL;
}
if (i == 0 && !argvlist[0][0]) {
free_string_array(argvlist, i);
free_string_array(argvlist, i + 1);
PyErr_SetString(
PyExc_ValueError,
"spawnv() arg 2 first element cannot be empty");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment