]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.6] bpo-30769: Fix reference leak introduced in 77703942c59 (GH-2416) (#2425)
authorEmily Morehouse <emily@cuttlesoft.com>
Tue, 27 Jun 2017 04:59:25 +0000 (22:59 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 27 Jun 2017 04:59:25 +0000 (07:59 +0300)
New error condition paths were introduced, which did not decrement
`key2` and `val2` objects.  Therefore, decrement references before
jumping to the error label.

Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
(cherry picked from commit a7874c73c0c729bbec2fd4b077bd0eec276cfff4)

Misc/ACKS
Modules/posixmodule.c

index c68f9eb9f1886779e60d7abe6e660e20fa5d3947..b8ae14be6914fca4981de7525415d2cbf054e5f1 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1590,6 +1590,7 @@ Andi Vajda
 Case Van Horsen
 John Mark Vandenberg
 Kyle VanderBeek
+Eric N. Vander Weele
 Andrew Vant
 Atul Varma
 Dmitry Vasiliev
index 033789099c3a84bcc58dd11ff47530702686090e..bf8254311e02dd049f2508320fc1bbd0ff2e3473 100644 (file)
@@ -4823,6 +4823,8 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr)
             PyUnicode_FindChar(key2, '=', 1, PyUnicode_GET_LENGTH(key2), 1) != -1)
         {
             PyErr_SetString(PyExc_ValueError, "illegal environment variable name");
+            Py_DECREF(key2);
+            Py_DECREF(val2);
             goto error;
         }
         keyval = PyUnicode_FromFormat("%U=%U", key2, val2);
@@ -4837,6 +4839,8 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr)
             strchr(PyBytes_AS_STRING(key2) + 1, '=') != NULL)
         {
             PyErr_SetString(PyExc_ValueError, "illegal environment variable name");
+            Py_DECREF(key2);
+            Py_DECREF(val2);
             goto error;
         }
         keyval = PyBytes_FromFormat("%s=%s", PyBytes_AS_STRING(key2),