[FFmpeg-cvslog] avfilter: do not leak frame if ff_get_audio_buffer() fails

Paul B Mahol git at videolan.org
Wed Nov 25 22:02:31 CET 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Nov 25 21:59:33 2015 +0100| [142894d7202b5559d87f58df30baf48107a816f6] | committer: Paul B Mahol

avfilter: do not leak frame if ff_get_audio_buffer() fails

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavfilter/af_adelay.c  |    4 +++-
 libavfilter/af_aecho.c   |    4 +++-
 libavfilter/af_biquads.c |    4 +++-
 libavfilter/af_chorus.c  |    4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index 6bae446..09bf3c7 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -192,8 +192,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         return ff_filter_frame(ctx->outputs[0], frame);
 
     out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
-    if (!out_frame)
+    if (!out_frame) {
+        av_frame_free(&frame);
         return AVERROR(ENOMEM);
+    }
     av_frame_copy_props(out_frame, frame);
 
     for (i = 0; i < s->nb_delays; i++) {
diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c
index 7e7a9d5..82049e9 100644
--- a/libavfilter/af_aecho.c
+++ b/libavfilter/af_aecho.c
@@ -279,8 +279,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         out_frame = frame;
     } else {
         out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
-        if (!out_frame)
+        if (!out_frame) {
+            av_frame_free(&frame);
             return AVERROR(ENOMEM);
+        }
         av_frame_copy_props(out_frame, frame);
     }
 
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index b5b258f..a6f9fbc 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -401,8 +401,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
         out_buf = buf;
     } else {
         out_buf = ff_get_audio_buffer(inlink, nb_samples);
-        if (!out_buf)
+        if (!out_buf) {
+            av_frame_free(&buf);
             return AVERROR(ENOMEM);
+        }
         av_frame_copy_props(out_buf, buf);
     }
 
diff --git a/libavfilter/af_chorus.c b/libavfilter/af_chorus.c
index 2bdaca3..c596164 100644
--- a/libavfilter/af_chorus.c
+++ b/libavfilter/af_chorus.c
@@ -247,8 +247,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
         out_frame = frame;
     } else {
         out_frame = ff_get_audio_buffer(inlink, frame->nb_samples);
-        if (!out_frame)
+        if (!out_frame) {
+            av_frame_free(&frame);
             return AVERROR(ENOMEM);
+        }
         av_frame_copy_props(out_frame, frame);
     }
 



More information about the ffmpeg-cvslog mailing list