From: Neal Norwitz Date: Mon, 10 Feb 2003 03:10:43 +0000 (+0000) Subject: Fix memory leak of newstr when putenv() fails X-Git-Tag: v2.3c1~1948 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4adc9abc32a26f5ce5e2dada33d019f31170b5be;p=thirdparty%2FPython%2Fcpython.git Fix memory leak of newstr when putenv() fails --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 2da5d41cc8d6..9dea4b525c72 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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; }