diff mbox series

[FFmpeg-devel,2/2] avcodec/svq3: Free array of frames in a loop

Message ID HE1PR0301MB21549F27714822456CAA2F9C8F4D9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 2a623bacc8457c51477f02f06ff9eff16afb615a
Headers show
Series [FFmpeg-devel,1/2] avcodec/svq3: Remove unused function parameter
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 15, 2021, 6:44 p.m. UTC
Avoids code duplication

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/svq3.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 0d108da06f..396555b337 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1587,12 +1587,10 @@  static av_cold int svq3_decode_end(AVCodecContext *avctx)
 {
     SVQ3Context *s = avctx->priv_data;
 
-    free_picture(s->cur_pic);
-    free_picture(s->next_pic);
-    free_picture(s->last_pic);
-    av_frame_free(&s->cur_pic->f);
-    av_frame_free(&s->next_pic->f);
-    av_frame_free(&s->last_pic->f);
+    for (int i = 0; i < FF_ARRAY_ELEMS(s->frames); i++) {
+        free_picture(&s->frames[i]);
+        av_frame_free(&s->frames[i].f);
+    }
     av_freep(&s->slice_buf);
     av_freep(&s->intra4x4_pred_mode);
     av_freep(&s->edge_emu_buffer);