Fixes #8303
Unified · Split
| @@ -780,6 +780,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 779 unmodified lines | ||
| 780 | 780 | res = av_frame_copy_props(out, in); |
| 781 | 781 | if (res < 0) { |
| 782 | 782 | av_frame_free(&in); |
| 783 | + av_frame_free(&out); | |
| 783 | 784 | return res; |
| 784 | 785 | } |
| 785 | 786 | |
| @@ -839,13 +840,18 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 53 unmodified lines | ||
| 839 | 840 | !s->dither_scratch_base[1][0] || !s->dither_scratch_base[1][1] || |
| 840 | 841 | !s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) { |
| 841 | 842 | uninit(ctx); |
| 843 | + av_frame_free(&in); | |
| 844 | + av_frame_free(&out); | |
| 842 | 845 | return AVERROR(ENOMEM); |
| 843 | 846 | } |
| 844 | 847 | s->rgb_sz = rgb_sz; |
| 845 | 848 | } |
| 846 | 849 | res = create_filtergraph(ctx, in, out); |
| 847 | − if (res < 0) | |
| 850 | + if (res < 0) { | |
| 851 | + av_frame_free(&in); | |
| 852 | + av_frame_free(&out); | |
| 848 | 853 | return res; |
| 854 | + } | |
| 849 | 855 | s->rgb_stride = rgb_stride / sizeof(int16_t); |
| 850 | 856 | td.in = in; |
| 851 | 857 | td.out = out; |
| @@ -859,8 +865,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 7 unmodified lines | ||
| 859 | 865 | td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h; |
| 860 | 866 | if (s->yuv2yuv_passthrough) { |
| 861 | 867 | res = av_frame_copy(out, in); |
| 862 | − if (res < 0) | |
| 868 | + if (res < 0) { | |
| 869 | + av_frame_free(&in); | |
| 870 | + av_frame_free(&out); | |
| 863 | 871 | return res; |
| 872 | + } | |
| 864 | 873 | } else { |
| 865 | 874 | ctx->internal->execute(ctx, convert, &td, NULL, |
| 866 | 875 | FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx))); |