[FFmpeg-cvslog] avfilter/vf_atadenoise: do not use uninitialized data

Paul B Mahol git at videolan.org
Tue Sep 29 20:59:01 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Sep 29 20:47:21 2015 +0200| [a019149249695f7b812ead18bc51fc2d8df57499] | committer: Paul B Mahol

avfilter/vf_atadenoise: do not use uninitialized data

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

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

 libavfilter/vf_atadenoise.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index 5127270..799a027 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -295,13 +295,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 
     if (s->q.available != s->size) {
         if (s->q.available < s->mid) {
-            out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
-            if (!out)
-                return AVERROR(ENOMEM);
-
-            for (i = 0; i < s->mid; i++)
-                ff_bufqueue_add(ctx, &s->q, av_frame_clone(out));
-            av_frame_free(&out);
+            for (i = 0; i < s->mid; i++) {
+                out = av_frame_clone(buf);
+                if (!out) {
+                    av_frame_free(&buf);
+                    return AVERROR(ENOMEM);
+                }
+                ff_bufqueue_add(ctx, &s->q, out);
+            }
         }
         if (s->q.available < s->size) {
             ff_bufqueue_add(ctx, &s->q, buf);
@@ -362,7 +363,7 @@ static int request_frame(AVFilterLink *outlink)
     ret = ff_request_frame(ctx->inputs[0]);
 
     if (ret == AVERROR_EOF && !ctx->is_disabled && s->available) {
-        AVFrame *buf = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+        AVFrame *buf = av_frame_clone(ff_bufqueue_peek(&s->q, s->available));
         if (!buf)
             return AVERROR(ENOMEM);
 



More information about the ffmpeg-cvslog mailing list