summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2018-05-02-08-36-03.bpo-33391.z4a7rb.rst1
-rw-r--r--Objects/setobject.c4
2 files changed, 4 insertions, 1 deletions
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
index 0000000000..ab17aa408c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-05-02-08-36-03.bpo-33391.z4a7rb.rst
@@ -0,0 +1 @@
+Fix a leak in set_symmetric_difference().
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 154be43564..31da3dbfec 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -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;
}