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

cmdutils.c:102:1: start of procedure parse_options()
100. }
101. 
102. void parse_options(int argc, char **argv, const OptionDef *options,
     ^
103.                    void (* parse_arg_function)(const char*))
104. {

cmdutils.c:106:5: 
104. {
105.     const char *opt, *arg;
106.     int optindex, handleoptions=1;
         ^
107.     const OptionDef *po;
108. 

cmdutils.c:110:5: 
108. 
109.     /* parse options */
110.     optindex = 1;
         ^
111.     while (optindex < argc) {
112.         opt = argv[optindex++];

cmdutils.c:111:12: Loop condition is true. Entering loop body
109.     /* parse options */
110.     optindex = 1;
111.     while (optindex < argc) {
                ^
112.         opt = argv[optindex++];
113. 

cmdutils.c:112:9: 
110.     optindex = 1;
111.     while (optindex < argc) {
112.         opt = argv[optindex++];
             ^
113. 
114.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {

cmdutils.c:114:13: Taking true branch
112.         opt = argv[optindex++];
113. 
114.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                 ^
115.           if (opt[1] == '-' && opt[2] == '\0') {
116.             handleoptions = 0;

cmdutils.c:114:30: Taking true branch
112.         opt = argv[optindex++];
113. 
114.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                                  ^
115.           if (opt[1] == '-' && opt[2] == '\0') {
116.             handleoptions = 0;

cmdutils.c:114:47: Taking true branch
112.         opt = argv[optindex++];
113. 
114.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
                                                   ^
115.           if (opt[1] == '-' && opt[2] == '\0') {
116.             handleoptions = 0;

cmdutils.c:115:15: Taking false branch
113. 
114.         if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
115.           if (opt[1] == '-' && opt[2] == '\0') {
                   ^
116.             handleoptions = 0;
117.             continue;

cmdutils.c:119:13: Skipping find_option(): empty list of specs
117.             continue;
118.           }
119.             po= find_option(options, opt + 1);
                 ^
120.             if (!po->name)
121.                 po= find_option(options, "default");

cmdutils.c:120:18: Taking false branch
118.           }
119.             po= find_option(options, opt + 1);
120.             if (!po->name)
                      ^
121.                 po= find_option(options, "default");
122.             if (!po->name) {

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

cmdutils.c:127:13: 
125.                 exit(1);
126.             }
127.             arg = NULL;
                 ^
128.             if (po->flags & HAS_ARG) {
129.                 arg = argv[optindex++];

cmdutils.c:128:17: Taking false branch
126.             }
127.             arg = NULL;
128.             if (po->flags & HAS_ARG) {
                     ^
129.                 arg = argv[optindex++];
130.                 if (!arg) {

cmdutils.c:135:17: Taking false branch
133.                 }
134.             }
135.             if (po->flags & OPT_STRING) {
                     ^
136.                 char *str;
137.                 str = av_strdup(arg);

cmdutils.c:139:24: Taking false branch
137.                 str = av_strdup(arg);
138.                 *po->u.str_arg = str;
139.             } else if (po->flags & OPT_BOOL) {
                            ^
140.                 *po->u.int_arg = 1;
141.             } else if (po->flags & OPT_INT) {

cmdutils.c:141:24: Taking true branch
139.             } else if (po->flags & OPT_BOOL) {
140.                 *po->u.int_arg = 1;
141.             } else if (po->flags & OPT_INT) {
                            ^
142.                 *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
143.             } else if (po->flags & OPT_INT64) {

cmdutils.c:142:17: 
140.                 *po->u.int_arg = 1;
141.             } else if (po->flags & OPT_INT) {
142.                 *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
                     ^
143.             } else if (po->flags & OPT_INT64) {
144.                 *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);

cmdutils.c:42:1: start of procedure parse_number_or_die()
  40. 
  41. 
  42. double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
      ^
  43. {
  44.     char *tail;

cmdutils.c:46:5: 
  44.     char *tail;
  45.     const char *error;
  46.     double d = strtod(numstr, &tail);
          ^
  47.     if (*tail)
  48.         error= "Expected number for %s but found: %s\n";

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

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

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

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

cmdutils.c:54:9: 
  52.         error= "Expected int64 for %s but found %s\n";
  53.     else
  54.         return d;
              ^
  55.     fprintf(stderr, error, context, numstr, min, max);
  56.     exit(1);

cmdutils.c:57:1: return from a call to parse_number_or_die
  55.     fprintf(stderr, error, context, numstr, min, max);
  56.     exit(1);
  57. }
      ^
  58. 
  59. 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}']