[FFmpeg-devel] [PATCH 1/2] ffbuild/bin2c: misc fix

Jun Zhao mypopy at gmail.com
Wed Jan 8 13:42:14 EET 2025


From: Jun Zhao <mypopydev at gmail.com>

close the input file if open output fail

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 ffbuild/bin2c.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ffbuild/bin2c.c b/ffbuild/bin2c.c
index dfeedd7669..168b0c658d 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];
-- 
2.25.1



More information about the ffmpeg-devel mailing list