animencoder_fuzzer: fix leak on alloc failure

Change-Id: Id626145a336fc33c4a4158719957f3c96db156c8
This commit is contained in:
James Zern 2023-06-30 17:29:04 +00:00
parent 5c965e55dd
commit 6be9bf8bae

View File

@ -47,6 +47,7 @@ int AddFrame(WebPAnimEncoder** const enc,
// Read the source picture.
if (!ExtractSourcePicture(&pic, data, size, bit_pos)) {
const WebPEncodingError error_code = pic.error_code;
WebPAnimEncoderDelete(*enc);
WebPPictureFree(&pic);
if (error_code == VP8_ENC_ERROR_OUT_OF_MEMORY) return 0;
fprintf(stderr, "Can't read input image. Error code: %d\n", error_code);