mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-23 19:44:13 +03:00
Fix leak opening _webp files
This commit is contained in:
parent
e5bd7eb623
commit
0da68dee98
|
@ -410,6 +410,7 @@ PyObject* _anim_decoder_get_next(PyObject* self, PyObject* args)
|
||||||
uint8_t* buf;
|
uint8_t* buf;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
PyObject* bytes;
|
PyObject* bytes;
|
||||||
|
PyObject* ret;
|
||||||
WebPAnimDecoderObject* decp = (WebPAnimDecoderObject*)self;
|
WebPAnimDecoderObject* decp = (WebPAnimDecoderObject*)self;
|
||||||
|
|
||||||
if (!WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)) {
|
if (!WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)) {
|
||||||
|
@ -419,7 +420,11 @@ PyObject* _anim_decoder_get_next(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
bytes = PyBytes_FromStringAndSize((char *)buf,
|
bytes = PyBytes_FromStringAndSize((char *)buf,
|
||||||
decp->info.canvas_width * 4 * decp->info.canvas_height);
|
decp->info.canvas_width * 4 * decp->info.canvas_height);
|
||||||
return Py_BuildValue("Si", bytes, timestamp);
|
|
||||||
|
ret = Py_BuildValue("Si", bytes, timestamp);
|
||||||
|
|
||||||
|
Py_DECREF(bytes);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* _anim_decoder_has_more_frames(PyObject* self, PyObject* args)
|
PyObject* _anim_decoder_has_more_frames(PyObject* self, PyObject* args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user