]> granicus.if.org Git - python/commitdiff
bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 2 May 2018 10:12:18 +0000 (03:12 -0700)
committerGitHub <noreply@github.com>
Wed, 2 May 2018 10:12:18 +0000 (03:12 -0700)
(cherry picked from commit 491bbedc209fea314a04cb3015da68fb0aa63238)

Co-authored-by: lekma <lekmalek@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2018-05-02-08-36-03.bpo-33391.z4a7rb.rst [new file with mode: 0644]
Objects/setobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-05-02-08-36-03.bpo-33391.z4a7rb.rst b/Misc/NEWS.d/next/Core and Builtins/2018-05-02-08-36-03.bpo-33391.z4a7rb.rst
new file mode 100644 (file)
index 0000000..ab17aa4
--- /dev/null
@@ -0,0 +1 @@
+Fix a leak in set_symmetric_difference().
index c742041b16deab8db67d96f048e8e08d31de2558..96485f83ecb63208c3749dcfb714db4c60f4f5c8 100644 (file)
@@ -1740,8 +1740,10 @@ set_symmetric_difference(PySetObject *so, PyObject *other)
     if (otherset == NULL)
         return NULL;
     rv = set_symmetric_difference_update(otherset, (PyObject *)so);
-    if (rv == NULL)
+    if (rv == NULL) {
+        Py_DECREF(otherset);
         return NULL;
+    }
     Py_DECREF(rv);
     return (PyObject *)otherset;
 }