cmdutils.c:161: error: Null Dereference
  pointer `arg` last assigned on line 142 could be null and is dereferenced by call to `parse_number_or_die()` at line 161, column 36.

cmdutils.c:117:1: start of procedure parse_options()
115. }
116. 
117. void parse_options(int argc, char **argv, const OptionDef *options,
     ^
118.                    void (* parse_arg_function)(const char*))
119. {

cmdutils.c:121:5: 
119. {
120.     const char *opt, *arg;
121.     int optindex, handleoptions=1;
         ^
122.     const OptionDef *po;
123. 

cmdutils.c:125:5: 
123. 
124.     /* parse options */
125.     optindex = 1;
         ^
126.     while (optindex < argc) {
127.         opt = argv[optindex++];

cmdutils.c:126:12: Loop condition is true. Entering loop body
124.     /* parse options */
125.     optindex = 1;
126.     while (optindex < argc) {
                ^
127.         opt = argv[optindex++];
128. 

cmdutils.c:127:9: 
125.     optindex = 1;
126.     while (optindex < argc) {
127.         opt = argv[optindex++];
             ^
128. 
129.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {

cmdutils.c:129:13: Taking true branch
127.         opt = argv[optindex++];
128. 
129.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                 ^
130.             if (opt[1] == '-' && opt[2] == '\0') {
131.                 handleoptions = 0;

cmdutils.c:129:30: Taking true branch
127.         opt = argv[optindex++];
128. 
129.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                                  ^
130.             if (opt[1] == '-' && opt[2] == '\0') {
131.                 handleoptions = 0;

cmdutils.c:129:47: Taking true branch
127.         opt = argv[optindex++];
128. 
129.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                                                   ^
130.             if (opt[1] == '-' && opt[2] == '\0') {
131.                 handleoptions = 0;

cmdutils.c:130:17: Taking false branch
128. 
129.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
130.             if (opt[1] == '-' && opt[2] == '\0') {
                     ^
131.                 handleoptions = 0;
132.                 continue;

cmdutils.c:134:13: Skipping find_option(): empty list of specs
132.                 continue;
133.             }
134.             po= find_option(options, opt + 1);
                 ^
135.             if (!po->name)
136.                 po= find_option(options, "default");

cmdutils.c:135:18: Taking false branch
133.             }
134.             po= find_option(options, opt + 1);
135.             if (!po->name)
                      ^
136.                 po= find_option(options, "default");
137.             if (!po->name) {

cmdutils.c:137:18: Taking false branch
135.             if (!po->name)
136.                 po= find_option(options, "default");
137.             if (!po->name) {
                      ^
138. unknown_opt:
139.                 fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);

cmdutils.c:142:13: 
140.                 exit(1);
141.             }
142.             arg = NULL;
                 ^
143.             if (po->flags & HAS_ARG) {
144.                 arg = argv[optindex++];

cmdutils.c:143:17: Taking false branch
141.             }
142.             arg = NULL;
143.             if (po->flags & HAS_ARG) {
                     ^
144.                 arg = argv[optindex++];
145.                 if (!arg) {

cmdutils.c:150:17: Taking false branch
148.                 }
149.             }
150.             if (po->flags & OPT_STRING) {
                     ^
151.                 char *str;
152.                 str = av_strdup(arg);

cmdutils.c:154:24: Taking false branch
152.                 str = av_strdup(arg);
153.                 *po->u.str_arg = str;
154.             } else if (po->flags & OPT_BOOL) {
                            ^
155.                 *po->u.int_arg = 1;
156.             } else if (po->flags & OPT_INT) {

cmdutils.c:156:24: Taking false branch
154.             } else if (po->flags & OPT_BOOL) {
155.                 *po->u.int_arg = 1;
156.             } else if (po->flags & OPT_INT) {
                            ^
157.                 *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158.             } else if (po->flags & OPT_INT64) {

cmdutils.c:158:24: Taking false branch
156.             } else if (po->flags & OPT_INT) {
157.                 *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158.             } else if (po->flags & OPT_INT64) {
                            ^
159.                 *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
160.             } else if (po->flags & OPT_FLOAT) {

cmdutils.c:160:24: Taking true branch
158.             } else if (po->flags & OPT_INT64) {
159.                 *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
160.             } else if (po->flags & OPT_FLOAT) {
                            ^
161.                 *po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
162.             } else if (po->flags & OPT_FUNC2) {

cmdutils.c:161:17: 
159.                 *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
160.             } else if (po->flags & OPT_FLOAT) {
161.                 *po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
                     ^
162.             } else if (po->flags & OPT_FUNC2) {
163.                 if(po->u.func2_arg(opt+1, arg)<0)

cmdutils.c:57:1: start of procedure parse_number_or_die()
  55. struct SwsContext *sws_opts;
  56. 
  57. double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
      ^
  58. {
  59.     char *tail;

cmdutils.c:61:5: 
  59.     char *tail;
  60.     const char *error;
  61.     double d = strtod(numstr, &tail);
          ^
  62.     if (*tail)
  63.         error= "Expected number for %s but found: %s\n";

cmdutils.c:62:9: Taking false branch
  60.     const char *error;
  61.     double d = strtod(numstr, &tail);
  62.     if (*tail)
              ^
  63.         error= "Expected number for %s but found: %s\n";
  64.     else if (d < min || d > max)

cmdutils.c:64:14: Taking false branch
  62.     if (*tail)
  63.         error= "Expected number for %s but found: %s\n";
  64.     else if (d < min || d > max)
                   ^
  65.         error= "The value for %s was %s which is not within %f - %f\n";
  66.     else if(type == OPT_INT64 && (int64_t)d != d)

cmdutils.c:64:25: Taking false branch
  62.     if (*tail)
  63.         error= "Expected number for %s but found: %s\n";
  64.     else if (d < min || d > max)
                              ^
  65.         error= "The value for %s was %s which is not within %f - %f\n";
  66.     else if(type == OPT_INT64 && (int64_t)d != d)

cmdutils.c:66:13: Taking false branch
  64.     else if (d < min || d > max)
  65.         error= "The value for %s was %s which is not within %f - %f\n";
  66.     else if(type == OPT_INT64 && (int64_t)d != d)
                  ^
  67.         error= "Expected int64 for %s but found %s\n";
  68.     else

cmdutils.c:69:9: 
  67.         error= "Expected int64 for %s but found %s\n";
  68.     else
  69.         return d;
              ^
  70.     fprintf(stderr, error, context, numstr, min, max);
  71.     exit(1);

cmdutils.c:72:1: return from a call to parse_number_or_die
  70.     fprintf(stderr, error, context, numstr, min, max);
  71.     exit(1);
  72. }
      ^
  73. 
  74. int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)

void parse_options(int argc, char **argv, const OptionDef *options,
                   void (* parse_arg_function)(const char*))
{
    const char *opt, *arg;
    int optindex, handleoptions=1;
    const OptionDef *po;
    optindex = 1;
    while (optindex < argc) {
        opt = argv[optindex++];
        if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
            if (opt[1] == '-' && opt[2] == '\0') {
                handleoptions = 0;
                continue;
            }
            po= find_option(options, opt + 1);
            if (!po->name)
                po= find_option(options, "default");
            if (!po->name) {
unknown_opt:
                fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
                exit(1);
            }
            arg = NULL;
            if (po->flags & HAS_ARG) {
                arg = argv[optindex++];
                if (!arg) {
                    fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
                    exit(1);
                }
            }
            if (po->flags & OPT_STRING) {
                char *str;
                str = av_strdup(arg);
                *po->u.str_arg = str;
            } else if (po->flags & OPT_BOOL) {
                *po->u.int_arg = 1;
            } else if (po->flags & OPT_INT) {
                *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
            } else if (po->flags & OPT_INT64) {
                *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
            } else if (po->flags & OPT_FLOAT) {
                *po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
            } else if (po->flags & OPT_FUNC2) {
                if(po->u.func2_arg(opt+1, arg)<0)
                    goto unknown_opt;
            } else {
                po->u.func_arg(arg);
            }
            if(po->flags & OPT_EXIT)
                exit(0);
        } else {
            if (parse_arg_function)
                parse_arg_function(opt);
        }
    }
}
['void parse_options(int argc, char **argv, const OptionDef *options,\n                   void (* parse_arg_function)(const char*))\n{\n    const char *opt, *arg;\n    int optindex, handleoptions=1;\n    const OptionDef *po;\n    optindex = 1;\n    while (optindex < argc) {\n        opt = argv[optindex++];\n        if (handleoptions && opt[0] == \'-\' && opt[1] != \'\\0\') {\n            if (opt[1] == \'-\' && opt[2] == \'\\0\') {\n                handleoptions = 0;\n                continue;\n            }\n            po= find_option(options, opt + 1);\n            if (!po->name)\n                po= find_option(options, "default");\n            if (!po->name) {\nunknown_opt:\n                fprintf(stderr, "%s: unrecognized option \'%s\'\\n", argv[0], opt);\n                exit(1);\n            }\n            arg = NULL;\n            if (po->flags & HAS_ARG) {\n                arg = argv[optindex++];\n                if (!arg) {\n                    fprintf(stderr, "%s: missing argument for option \'%s\'\\n", argv[0], opt);\n                    exit(1);\n                }\n            }\n            if (po->flags & OPT_STRING) {\n                char *str;\n                str = av_strdup(arg);\n                *po->u.str_arg = str;\n            } else if (po->flags & OPT_BOOL) {\n                *po->u.int_arg = 1;\n            } else if (po->flags & OPT_INT) {\n                *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);\n            } else if (po->flags & OPT_INT64) {\n                *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);\n            } else if (po->flags & OPT_FLOAT) {\n                *po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);\n            } else if (po->flags & OPT_FUNC2) {\n                if(po->u.func2_arg(opt+1, arg)<0)\n                    goto unknown_opt;\n            } else {\n                po->u.func_arg(arg);\n            }\n            if(po->flags & OPT_EXIT)\n                exit(0);\n        } else {\n            if (parse_arg_function)\n                parse_arg_function(opt);\n        }\n    }\n}', 'double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)\n{\n    char *tail;\n    const char *error;\n    double d = strtod(numstr, &tail);\n    if (*tail)\n        error= "Expected number for %s but found: %s\\n";\n    else if (d < min || d > max)\n        error= "The value for %s was %s which is not within %f - %f\\n";\n    else if(type == OPT_INT64 && (int64_t)d != d)\n        error= "Expected int64 for %s but found %s\\n";\n    else\n        return d;\n    fprintf(stderr, error, context, numstr, min, max);\n    exit(1);\n}']