bpo-33391: Fix refleak in set_symmetric_difference (GH-6670)

(cherry picked from commit 491bbedc20)

Co-authored-by: lekma <lekmalek@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-05-02 03:23:41 -07:00 committed by GitHub
parent 5818f08962
commit 6d3d02c69a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix a leak in set_symmetric_difference().

View File

@ -1710,8 +1710,10 @@ set_symmetric_difference(PySetObject *so, PyObject *other)
if (otherset == NULL) if (otherset == NULL)
return NULL; return NULL;
rv = set_symmetric_difference_update(otherset, (PyObject *)so); rv = set_symmetric_difference_update(otherset, (PyObject *)so);
if (rv == NULL) if (rv == NULL) {
Py_DECREF(otherset);
return NULL; return NULL;
}
Py_DECREF(rv); Py_DECREF(rv);
return (PyObject *)otherset; return (PyObject *)otherset;
} }