1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_colorconstancy: av_frame_free(&in) in case of error or direct flag is false

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Limin Wang 2019-11-27 18:46:51 +08:00 committed by Michael Niedermayer
parent df625057af
commit 3a6ec10d90

View File

@ -682,13 +682,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out;
int ret;
int direct = 0;
ret = illumination_estimation(ctx, in);
if (ret) {
av_frame_free(&in);
return ret;
}
if (av_frame_is_writable(in)) {
direct = 1;
out = in;
} else {
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
@ -700,6 +703,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
chromatic_adaptation(ctx, in, out);
if (!direct)
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}