[FFmpeg-cvslog] ffbuild/bin2c: misc fix

Jun Zhao git at videolan.org
Mon Jan 13 18:00:07 EET 2025


ffmpeg | branch: master | Jun Zhao <mypopydev at gmail.com> | Wed Jan  8 19:04:12 2025 +0800| [8ded602edad43227aa5b84ac8041d4b174ec9431] | committer: Jun Zhao

ffbuild/bin2c: misc fix

close input file if open output fail/read errors.

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
Signed-off-by: Jun Zhao <barryjzhao at tencent.com>

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

 ffbuild/bin2c.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ffbuild/bin2c.c b/ffbuild/bin2c.c
index dfeedd7669..91f2d81e5b 100644
--- a/ffbuild/bin2c.c
+++ b/ffbuild/bin2c.c
@@ -38,8 +38,10 @@ int main(int argc, char **argv)
         return -1;
 
     output = fopen(argv[2], "wb");
-    if (!output)
+    if (!output) {
+        fclose(input);
         return -1;
+    }
 
     if (argc == 4) {
         name = argv[3];
@@ -67,8 +69,10 @@ int main(int argc, char **argv)
 
     fclose(output);
 
-    if (ferror(input) || !feof(input))
+    if (ferror(input) || !feof(input)) {
+        fclose(input);
         return -1;
+    }
 
     fclose(input);
 



More information about the ffmpeg-cvslog mailing list