On Wed, 23 Mar 2022, Andrey Volk wrote:

Signed-off-by: Andrey Volk <andyw...@gmail.com>
---
libavcodec/libwebpenc_animencoder.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Thanks, applied.

Regards,
Marton


diff --git a/libavcodec/libwebpenc_animencoder.c
b/libavcodec/libwebpenc_animencoder.c
index 0f5b524335..29c0d8bb0f 100644
--- a/libavcodec/libwebpenc_animencoder.c
+++ b/libavcodec/libwebpenc_animencoder.c
@@ -70,14 +70,18 @@ static int libwebp_anim_encode_frame(AVCodecContext
*avctx, AVPacket *pkt,
            ret = WebPAnimEncoderAssemble(s->enc, &assembled_data);
            if (ret) {
                ret = ff_get_encode_buffer(avctx, pkt,
assembled_data.size, 0);
-                if (ret < 0)
+                if (ret < 0) {
+                    WebPDataClear(&assembled_data);
                    return ret;
+                }
                memcpy(pkt->data, assembled_data.bytes,
assembled_data.size);
+                WebPDataClear(&assembled_data);
                s->done = 1;
                pkt->pts = pkt->dts = s->first_frame_pts;
                *got_packet = 1;
                return 0;
            } else {
+                WebPDataClear(&assembled_data);
                av_log(s, AV_LOG_ERROR,
                       "WebPAnimEncoderAssemble() failed with error: %d\n",
                       VP8_ENC_ERROR_OUT_OF_MEMORY);
--
2.33.0.windows.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to