Skip to content

Commit c07b858

Browse files
committed
Fix memory leak of iterator in array.array constructor
1 parent a0eafb0 commit c07b858

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/arraymodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,11 +3063,13 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
30633063
PySequence_GetItem(initial, i);
30643064
if (v == NULL) {
30653065
Py_DECREF(a);
3066+
Py_XDECREF(it);
30663067
return NULL;
30673068
}
30683069
if (setarrayitem(a, i, v) != 0) {
30693070
Py_DECREF(v);
30703071
Py_DECREF(a);
3072+
Py_XDECREF(it);
30713073
return NULL;
30723074
}
30733075
Py_DECREF(v);

0 commit comments

Comments
 (0)