diff mbox series

[FFmpeg-devel,1/3] lavc/decode: clear side data in reget_buffer()

Message ID 20240922180005.6549-1-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/3] lavc/decode: clear side data in reget_buffer() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Sept. 22, 2024, 6 p.m. UTC
Otherwise it may accumulate when e.g. global side data is repeatedly
copied to the frame with in each subsequent reget_buffer() call.
---
 libavcodec/decode.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 1f2fbda6ad..57cca44d05 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1685,6 +1685,8 @@  static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flag
     if (!frame->data[0])
         return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
 
+    av_frame_side_data_free(&frame->side_data, &frame->nb_side_data);
+
     if ((flags & FF_REGET_BUFFER_FLAG_READONLY) || av_frame_is_writable(frame))
         return ff_decode_frame_props(avctx, frame);