[FFmpeg-cvslog] avfilter/af_afftdn: fix memory leaks reported by coverity

Paul B Mahol git at videolan.org
Sun Oct 28 23:33:53 EET 2018


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Oct 28 22:30:06 2018 +0100| [e95987f6ca8e6872ca3a47f36ed8d304f88b2bfe] | committer: Paul B Mahol

avfilter/af_afftdn: fix memory leaks reported by coverity

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

 libavfilter/af_afftdn.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c
index 428375b694..ed2c1c1def 100644
--- a/libavfilter/af_afftdn.c
+++ b/libavfilter/af_afftdn.c
@@ -1163,15 +1163,13 @@ static int output_frame(AVFilterLink *inlink)
     ThreadData td;
     int ret = 0;
 
-    if (!in) {
-        in = ff_get_audio_buffer(outlink, s->window_length);
-        if (!in)
-            return AVERROR(ENOMEM);
-    }
+    in = ff_get_audio_buffer(outlink, s->window_length);
+    if (!in)
+        return AVERROR(ENOMEM);
 
     ret = av_audio_fifo_peek(s->fifo, (void **)in->extended_data, s->window_length);
     if (ret < 0)
-        return ret;
+        goto end;
 
     if (s->track_noise) {
         for (int ch = 0; ch < inlink->channels; ch++) {
@@ -1248,7 +1246,9 @@ static int output_frame(AVFilterLink *inlink)
                 dst[m] = orig[m] - src[m];
             break;
         default:
-            return AVERROR_BUG;
+            av_frame_free(&out);
+            ret = AVERROR_BUG;
+            goto end;
         }
         memmove(src, src + s->sample_advance, (s->window_length - s->sample_advance) * sizeof(*src));
         memset(src + (s->window_length - s->sample_advance), 0, s->sample_advance * sizeof(*src));



More information about the ffmpeg-cvslog mailing list