[FFmpeg-cvslog] avfilter: Read errno before av_log() as the callback from av_log() might affect errno

Michael Niedermayer git at videolan.org
Sat Oct 25 13:40:05 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Oct 25 13:19:41 2014 +0200| [0d96d44c4fa526582500718254ac9e19f984c6a5] | committer: Michael Niedermayer

avfilter: Read errno before av_log() as the callback from av_log() might affect errno

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/vf_vidstabdetect.c    |    3 ++-
 libavfilter/vf_vidstabtransform.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c
index bf067af..1df6f74 100644
--- a/libavfilter/vf_vidstabdetect.c
+++ b/libavfilter/vf_vidstabdetect.c
@@ -176,8 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         return AVERROR(AVERROR_EXTERNAL);
     } else {
         if (vsWriteToFile(md, sd->f, &localmotions) != VS_OK) {
+            int ret = AVERROR(errno);
             av_log(ctx, AV_LOG_ERROR, "cannot write to transform file");
-            return AVERROR(errno);
+            return ret;
         }
         vs_vector_del(&localmotions);
     }
diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c
index 1bd43ff..9db6a46 100644
--- a/libavfilter/vf_vidstabtransform.c
+++ b/libavfilter/vf_vidstabtransform.c
@@ -208,8 +208,9 @@ static int config_input(AVFilterLink *inlink)
 
     f = fopen(tc->input, "r");
     if (!f) {
+        int ret = AVERROR(errno);
         av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input);
-        return AVERROR(errno);
+        return ret;
     } else {
         VSManyLocalMotions mlms;
         if (vsReadLocalMotionsFile(f, &mlms) == VS_OK) {



More information about the ffmpeg-cvslog mailing list