]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38823: Clean up refleaks in _contextvars initialization. (GH-17198)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 17 Nov 2019 00:14:45 +0000 (16:14 -0800)
committerGitHub <noreply@github.com>
Sun, 17 Nov 2019 00:14:45 +0000 (16:14 -0800)
https://bugs.python.org/issue38823
(cherry picked from commit 143a97f64128070386b12a0ee589bdaad5e51f40)

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Modules/_contextvarsmodule.c

index 71dd7fd8d08d43b8e9b9227dc654ed54f7bcb04b..1abcdbfa921c272bab371f1818dc7fd6ca1779c4 100644 (file)
@@ -52,6 +52,7 @@ PyInit__contextvars(void)
                            (PyObject *)&PyContext_Type) < 0)
     {
         Py_DECREF(&PyContext_Type);
+        Py_DECREF(m);
         return NULL;
     }
 
@@ -60,6 +61,7 @@ PyInit__contextvars(void)
                            (PyObject *)&PyContextVar_Type) < 0)
     {
         Py_DECREF(&PyContextVar_Type);
+        Py_DECREF(m);
         return NULL;
     }
 
@@ -68,6 +70,7 @@ PyInit__contextvars(void)
                            (PyObject *)&PyContextToken_Type) < 0)
     {
         Py_DECREF(&PyContextToken_Type);
+        Py_DECREF(m);
         return NULL;
     }