]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/svq3: Free array of frames in a loop
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 15 Apr 2021 15:17:21 +0000 (17:17 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Mon, 26 Apr 2021 19:15:33 +0000 (21:15 +0200)
Avoids code duplication

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/svq3.c

index 0d108da06f210ca05f46b20a9a9efbd77f9a5a9e..396555b337397d140dc76cdf48814adfa30fd849 100644 (file)
@@ -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);