WebP: Fix memory leak during decoding on failure

When creating the `WebPAnimDecoder` object, we create a `WebPAnimDecoderObject` and populate its data using `WebPDataCopy()`.

Subsequently, if either `WebPAnimDecoderNew()` or `WebPAnimDecoderGetInfo()` fails, data is not currently deallocated. This commit clears the decoder object's data in that situation.
This commit is contained in:
Ilaï Deutel 2021-10-28 18:15:43 +00:00
parent caa0deb4c7
commit 596e80c654
No known key found for this signature in database
GPG Key ID: E22D2429C1CFC42D

View File

@ -392,6 +392,7 @@ _anim_decoder_new(PyObject *self, PyObject *args) {
return (PyObject *)decp;
}
}
WebPDataClear(&(decp->data));
}
PyObject_Del(decp);
}