fix refleak in deque_concat

This commit is contained in:
Benjamin Peterson 2015-04-04 10:52:36 -04:00
parent de1c27feaa
commit 1a6292194b
1 changed files with 8 additions and 2 deletions

View File

@ -507,7 +507,7 @@ static PyObject *deque_copy(PyObject *deque);
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 @@ deque_concat(dequeobject *deque, PyObject *other)
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);