Commit 4adc9abc authored by Neal Norwitz's avatar Neal Norwitz

Fix memory leak of newstr when putenv() fails

parent de8b94c3
...@@ -5662,6 +5662,7 @@ posix_putenv(PyObject *self, PyObject *args) ...@@ -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;
} }
......
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