[FFmpeg-cvslog] avfilter/vf_deshake: Free out AVFrame on error

Michael Niedermayer git at videolan.org
Fri Feb 3 23:06:14 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Feb  3 19:37:18 2017 +0100| [15b2c37d5e1155a96630eb5f8758fd849d6b2a2e] | committer: Michael Niedermayer

avfilter/vf_deshake: Free out AVFrame on error

Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavfilter/vf_deshake.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index 4eae988..64b48c6 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -450,7 +450,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     if (CONFIG_OPENCL && deshake->opencl) {
         ret = ff_opencl_deshake_process_inout_buf(link->dst,in, out);
         if (ret < 0)
-            return ret;
+            goto fail;
     }
 
     if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
@@ -536,13 +536,16 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     av_frame_free(&deshake->ref);
 
     if (ret < 0)
-        return ret;
+        goto fail;
 
     // Store the current frame as the reference frame for calculating the
     // motion of the next frame
     deshake->ref = in;
 
     return ff_filter_frame(outlink, out);
+fail:
+    av_frame_free(&out);
+    return ret;
 }
 
 static const AVFilterPad deshake_inputs[] = {



More information about the ffmpeg-cvslog mailing list