aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-04-17 13:34:53 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-04-20 22:04:36 +0200
commitbad3f308d39d16db5d1629bc7a65d89ce4a0e3dd (patch)
tree266d0e6c2fe901ce3c02a8f3a9dbbb38f4fd033d
parentd42ba1384a03eedc389a1b5fea4a9d95fc8d6b33 (diff)
downloadffmpeg-bad3f308d39d16db5d1629bc7a65d89ce4a0e3dd.tar.gz
avcodec/magicyuvenc: Hoist check out of loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/magicyuvenc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c
index 94e8d31122..02b570d618 100644
--- a/libavcodec/magicyuvenc.c
+++ b/libavcodec/magicyuvenc.c
@@ -625,12 +625,14 @@ static av_cold int magy_encode_close(AVCodecContext *avctx)
{
MagicYUVContext *s = avctx->priv_data;
- for (int i = 0; i < s->planes * s->nb_slices && s->slices; i++) {
- Slice *sl = &s->slices[i];
+ if (s->slices) {
+ for (int i = 0; i < s->planes * s->nb_slices; i++) {
+ Slice *sl = &s->slices[i];
- av_freep(&sl->slice);
+ av_freep(&sl->slice);
+ }
+ av_freep(&s->slices);
}
- av_freep(&s->slices);
av_freep(&s->decorrelate_buf);
return 0;