[FFmpeg-devel] [PATCH] ffmpeg_opt: check fclose return value

Ganesh Ajjanagadde gajjanagadde at gmail.com
Mon Jan 11 23:35:17 CET 2016


This one may be slightly more theoretical, since the preset file is opened in a
read-only mode. Nevertheless, it is a good idea to check its return value.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 ffmpeg_opt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 9b341cf..13786da 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2724,7 +2724,10 @@ static int opt_preset(void *optctx, const char *opt, const char *arg)
         }
     }
 
-    fclose(f);
+    if (fclose(f))
+        av_log(NULL, AV_LOG_ERROR,
+               "Error closing preset file: %s\n",
+               av_err2str(AVERROR(errno)));
 
     return 0;
 }
-- 
2.7.0



More information about the ffmpeg-devel mailing list