mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fix memory leak of newstr when putenv() fails
This commit is contained in:
parent
de8b94c3e1
commit
4adc9abc32
1 changed files with 1 additions and 0 deletions
|
@ -5662,6 +5662,7 @@ posix_putenv(PyObject *self, PyObject *args)
|
|||
new = PyString_AS_STRING(newstr);
|
||||
PyOS_snprintf(new, len, "%s=%s", s1, s2);
|
||||
if (putenv(new)) {
|
||||
Py_DECREF(newstr);
|
||||
posix_error();
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue