]> granicus.if.org Git - python/commitdiff
Fix refcount.
authorRaymond Hettinger <python@rcn.com>
Sun, 13 Sep 2015 06:41:18 +0000 (02:41 -0400)
committerRaymond Hettinger <python@rcn.com>
Sun, 13 Sep 2015 06:41:18 +0000 (02:41 -0400)
Modules/_collectionsmodule.c

index 7f814607961f0a98ee89bf8c2a3e15a3f5ed3a4b..17233e4089450303400b24da0f17500c4a50445a 100644 (file)
@@ -616,11 +616,14 @@ static PyObject *
 deque_repeat(dequeobject *deque, Py_ssize_t n)
 {
     dequeobject *new_deque;
+    PyObject *rv;
 
     new_deque = (dequeobject *)deque_copy((PyObject *) deque);
     if (new_deque == NULL)
         return NULL;
-    return deque_inplace_repeat(new_deque, n);
+    rv = deque_inplace_repeat(new_deque, n);
+    Py_DECREF(new_deque);
+    return rv;
 }
 
 /* The rotate() method is part of the public API and is used internally