diff mbox series

[FFmpeg-devel,31/47] fftools/opt_common: replace exit_program() with returning error codes

Message ID 20230715104611.17902-31-anton@khirnov.net
State Accepted
Commit 4adbe2d219c13d5342d073aace5001a64c57d9c8
Headers show
Series [FFmpeg-devel,01/47] fftools/ffmpeg_mux_init: handle pixel format endianness | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov July 15, 2023, 10:45 a.m. UTC
---
 fftools/opt_common.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index f6fe9815e1..39258bb46c 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -1159,7 +1159,9 @@  int init_report(const char *env, FILE **file)
             report_file_level = strtol(val, &tail, 10);
             if (*tail) {
                 av_log(NULL, AV_LOG_FATAL, "Invalid report file level\n");
-                exit_program(1);
+                av_free(key);
+                av_free(val);
+                return AVERROR(EINVAL);
             }
             envlevel = 1;
         } else {
@@ -1219,7 +1221,7 @@  int opt_max_alloc(void *optctx, const char *opt, const char *arg)
     max = strtol(arg, &tail, 10);
     if (*tail) {
         av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg);
-        exit_program(1);
+        return AVERROR(EINVAL);
     }
     av_max_alloc(max);
     return 0;
@@ -1293,7 +1295,7 @@  int opt_loglevel(void *optctx, const char *opt, const char *arg)
                "Possible levels are numbers or:\n", arg);
         for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
             av_log(NULL, AV_LOG_FATAL, "\"%s\"\n", log_levels[i].name);
-        exit_program(1);
+        return AVERROR(EINVAL);
     }
 
 end: