[FFmpeg-cvslog] avfilter/vf_colorconstancy: av_frame_free(&in) in case of error or direct flag is false

Limin Wang git at videolan.org
Thu Nov 28 19:50:42 EET 2019


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Wed Nov 27 18:46:51 2019 +0800| [3a6ec10d904f5f9d38900a79281000ca1d0a0747] | committer: Michael Niedermayer

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

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a6ec10d904f5f9d38900a79281000ca1d0a0747
---

 libavfilter/vf_colorconstancy.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c
index cc081e957f..9917d8993e 100644
--- a/libavfilter/vf_colorconstancy.c
+++ b/libavfilter/vf_colorconstancy.c
@@ -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);
 }
 



More information about the ffmpeg-cvslog mailing list