Fix memory leak of newstr when putenv() fails

This commit is contained in:
Neal Norwitz 2003-02-10 03:10:43 +00:00
parent de8b94c3e1
commit 4adc9abc32

View file

@ -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;
} }