aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-18 10:48:22 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-05-04 19:57:11 +0200
commit64d2e0b20066058cf1c6dc3c49adab6d18d66fcc (patch)
treef440102d2592b4f6e9d956d7f47f53c83a1490e0
parentbbc9751da67286d27f379dbe3b52ee3b55b0503e (diff)
downloadffmpeg-64d2e0b20066058cf1c6dc3c49adab6d18d66fcc.tar.gz
avfilter/vf_colorspace: fix memmory leaks
Fixes #8303 (cherry picked from commit fddef964e8aa4a2c123e470db1436a082ff6bcf3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavfilter/vf_colorspace.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 930aa951f1..43385bc687 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -891,6 +891,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
res = av_frame_copy_props(out, in);
if (res < 0) {
av_frame_free(&in);
+ av_frame_free(&out);
return res;
}
@@ -950,13 +951,18 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
!s->dither_scratch_base[1][0] || !s->dither_scratch_base[1][1] ||
!s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) {
uninit(ctx);
+ av_frame_free(&in);
+ av_frame_free(&out);
return AVERROR(ENOMEM);
}
s->rgb_sz = rgb_sz;
}
res = create_filtergraph(ctx, in, out);
- if (res < 0)
+ if (res < 0) {
+ av_frame_free(&in);
+ av_frame_free(&out);
return res;
+ }
s->rgb_stride = rgb_stride / sizeof(int16_t);
td.in = in;
td.out = out;
@@ -970,8 +976,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h;
if (s->yuv2yuv_passthrough) {
res = av_frame_copy(out, in);
- if (res < 0)
+ if (res < 0) {
+ av_frame_free(&in);
+ av_frame_free(&out);
return res;
+ }
} else {
ctx->internal->execute(ctx, convert, &td, NULL,
FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx)));