Eryk Sun added the comment:

The memory leak is in os_spawnv_impl and os_spawnve_impl in 
Modules/posixmodule.c. The call fails with a ValueError when the first argument 
in the argv list is an empty string, in which case these functions both 
mistakenly pass i (0) to free_string_array() as the count of strings to free. 
But the conversion was successful, so it needs to include the current string in 
the count, i.e. `i + 1`.

The fix for this could also address the following two issues, which are mostly 
cosmetic in nature. os_spawnve_impl needs its TypeError message to be special 
cased the same as in os_spawnv_impl, i.e. "spawnve() arg 2 must contain only 
strings". Currently it uses the default message from the failed conversion: 
"expected str, bytes or os.PathLike object, not %.200s". Also, its ValueError 
message needs to reference "spawnve()" instead of "spawnv()".

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30602>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to