mirror of https://github.com/python/cpython
Fix memory leak: Always DECREF obj in PyBuffer_Release.
This commit is contained in:
parent
6d2014ee59
commit
64034f994c
|
@ -708,11 +708,9 @@ void
|
|||
PyBuffer_Release(Py_buffer *view)
|
||||
{
|
||||
PyObject *obj = view->obj;
|
||||
if (!obj || !Py_TYPE(obj)->tp_as_buffer || !Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer)
|
||||
/* Unmanaged buffer */
|
||||
return;
|
||||
Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer(obj, view);
|
||||
Py_DECREF(obj);
|
||||
if (obj && Py_TYPE(obj)->tp_as_buffer && Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer)
|
||||
Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer(obj, view);
|
||||
Py_XDECREF(obj);
|
||||
view->obj = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue