]> git.ipfire.org Git - thirdparty/Python/cpython.git/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:23:41 +0000 (03:23 -0700)
committerGitHub <noreply@github.com>
Wed, 2 May 2018 10:23:41 +0000 (03:23 -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 154be43564dd6d03b7b8ce8e2389edbde4c9352e..31da3dbfecb1745fc25c2665d93e44046c348c2e 100644 (file)
@@ -1710,8 +1710,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;
 }