mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +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);
|
new = PyString_AS_STRING(newstr);
|
||||||
PyOS_snprintf(new, len, "%s=%s", s1, s2);
|
PyOS_snprintf(new, len, "%s=%s", s1, s2);
|
||||||
if (putenv(new)) {
|
if (putenv(new)) {
|
||||||
|
Py_DECREF(newstr);
|
||||||
posix_error();
|
posix_error();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue