mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-09 14:14:39 +02:00
avfilter/vf_colorspace: fix memmory leaks
Fixes #8303 (cherry picked from commit fddef964e8aa4a2c123e470db1436a082ff6bcf3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
bbc9751da6
commit
64d2e0b200
@ -891,6 +891,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
|||||||
res = av_frame_copy_props(out, in);
|
res = av_frame_copy_props(out, in);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
|
av_frame_free(&out);
|
||||||
return res;
|
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[1][0] || !s->dither_scratch_base[1][1] ||
|
||||||
!s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) {
|
!s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) {
|
||||||
uninit(ctx);
|
uninit(ctx);
|
||||||
|
av_frame_free(&in);
|
||||||
|
av_frame_free(&out);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
s->rgb_sz = rgb_sz;
|
s->rgb_sz = rgb_sz;
|
||||||
}
|
}
|
||||||
res = create_filtergraph(ctx, in, out);
|
res = create_filtergraph(ctx, in, out);
|
||||||
if (res < 0)
|
if (res < 0) {
|
||||||
|
av_frame_free(&in);
|
||||||
|
av_frame_free(&out);
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
s->rgb_stride = rgb_stride / sizeof(int16_t);
|
s->rgb_stride = rgb_stride / sizeof(int16_t);
|
||||||
td.in = in;
|
td.in = in;
|
||||||
td.out = out;
|
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;
|
td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h;
|
||||||
if (s->yuv2yuv_passthrough) {
|
if (s->yuv2yuv_passthrough) {
|
||||||
res = av_frame_copy(out, in);
|
res = av_frame_copy(out, in);
|
||||||
if (res < 0)
|
if (res < 0) {
|
||||||
|
av_frame_free(&in);
|
||||||
|
av_frame_free(&out);
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx->internal->execute(ctx, convert, &td, NULL,
|
ctx->internal->execute(ctx, convert, &td, NULL,
|
||||||
FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx)));
|
FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user