[FFmpeg-devel] [PATCH 04/13] lavfi/vf_paletteuse: check fclose return value

Ganesh Ajjanagadde gajjanagadde at gmail.com
Tue Jan 12 05:25:06 CET 2016


Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavfilter/vf_paletteuse.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 1225a66..a5449df 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -525,7 +525,13 @@ static int disp_tree(const struct color_node *node, const char *fname)
     av_bprintf(&buf, "}\n");
 
     fwrite(buf.str, 1, buf.len, f);
-    fclose(f);
+    if (fclose(f)) {
+        int ret = AVERROR(errno);
+        av_log(NULL, AV_LOG_ERROR,
+               "Unable to close file '%s', loss of information possible: %s\n",
+               fname, av_err2str(AVERROR(errno)));
+        return ret;
+    }
     av_bprint_finalize(&buf, NULL);
     return 0;
 }
-- 
2.7.0



More information about the ffmpeg-devel mailing list