[Python-checkins] cpython: fix refleak in deque_concat
benjamin.peterson
python-checkins at python.org
Sat Apr 4 16:52:58 CEST 2015
https://hg.python.org/cpython/rev/3409f4d945e8
changeset: 95443:3409f4d945e8
user: Benjamin Peterson <benjamin at python.org>
date: Sat Apr 04 10:52:36 2015 -0400
summary:
fix refleak in deque_concat
files:
Modules/_collectionsmodule.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -507,7 +507,7 @@
static PyObject *
deque_concat(dequeobject *deque, PyObject *other)
{
- PyObject *new_deque;
+ PyObject *new_deque, *result;
int rv;
rv = PyObject_IsInstance(other, (PyObject *)&deque_type);
@@ -523,7 +523,13 @@
new_deque = deque_copy((PyObject *)deque);
if (new_deque == NULL)
return NULL;
- return deque_inplace_concat((dequeobject *)new_deque, other);
+ result = deque_extend((dequeobject *)new_deque, other);
+ if (result == NULL) {
+ Py_DECREF(new_deque);
+ return NULL;
+ }
+ Py_DECREF(result);
+ return new_deque;
}
static void deque_clear(dequeobject *deque);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list