Unified · Split
| @@ -625,12 +625,14 @@ static av_cold int magy_encode_close(AVCodecContext *avctx) · 624 unmodified lines | |||
| 625 | { | 625 | { |
| 626 | MagicYUVContext *s = avctx->priv_data; | 626 | MagicYUVContext *s = avctx->priv_data; |
| 627 | 627 | ||
| 628 | for (int i = 0; i < s->planes * s->nb_slices && s->slices; i++) { | 628 | if (s->slices) { |
| 629 | Slice *sl = &s->slices[i]; | 629 | for (int i = 0; i < s->planes * s->nb_slices; i++) { |
| 630 | Slice *sl = &s->slices[i]; | ||
| 630 | 631 | ||
| 631 | av_freep(&sl->slice); | 632 | av_freep(&sl->slice); |
| 633 | } | ||
| 634 | av_freep(&s->slices); | ||
| 632 | } | 635 | } |
| 633 | av_freep(&s->slices); | ||
| 634 | av_freep(&s->decorrelate_buf); | 636 | av_freep(&s->decorrelate_buf); |
| 635 | 637 | ||
| 636 | return 0; | 638 | return 0; |