]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_deshake: Free out AVFrame on error
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 3 Feb 2017 18:37:18 +0000 (19:37 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 3 Feb 2017 20:52:22 +0000 (21:52 +0100)
Fixes memleak
Fixes part of CID1197065

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/vf_deshake.c

index 4eae9885c6cdf6f5eb5ddf9a4c9049fc308a5cbc..64b48c6d02fde5fc1278f974ea66240ce144c158 100644 (file)
@@ -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[] = {