]> granicus.if.org Git - python/commitdiff
Fix memory leak of newstr when putenv() fails
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 10 Feb 2003 03:10:43 +0000 (03:10 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 10 Feb 2003 03:10:43 +0000 (03:10 +0000)
Modules/posixmodule.c

index 2da5d41cc8d608f00a2594613c60197d39242965..9dea4b525c7245f824d52ac97f1d908b7f28561d 100644 (file)
@@ -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;
        }