Add Py_DECREF for each sequence returned by PySequence_Fast, so that these sequences are not leaked. Fixes #1187.

This commit is contained in:
Gareth Rees 2015-04-16 14:33:57 +01:00
parent 5be6f810a5
commit b97a1eee25

View File

@ -422,6 +422,7 @@ getlist(PyObject* arg, int* length, const char* wrong_length, int type)
PyErr_Clear();
Py_DECREF(seq);
return list;
}
@ -1289,6 +1290,7 @@ _putdata(ImagingObject* self, PyObject* args)
}
}
PyErr_Clear(); /* Avoid weird exceptions */
Py_DECREF(seq);
}
} else {
/* 32-bit images */
@ -1340,6 +1342,7 @@ _putdata(ImagingObject* self, PyObject* args)
PyErr_Clear(); /* Avoid weird exceptions */
break;
}
Py_DECREF(seq);
}
Py_INCREF(Py_None);