avconv.c:3089: error: Null Dereference
  pointer `meta_in` last assigned on line 3023 could be null and is dereferenced at line 3089, column 32.

avconv.c:3021:1: start of procedure copy_metadata()
3019. }
3020. 
3021. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
      ^
3022. {
3023.     AVDictionary **meta_in = NULL;

avconv.c:3023:5: 
3021. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
3022. {
3023.     AVDictionary **meta_in = NULL;
          ^
3024.     AVDictionary **meta_out;
3025.     int i, ret = 0;

avconv.c:3025:5: 
3023.     AVDictionary **meta_in = NULL;
3024.     AVDictionary **meta_out;
3025.     int i, ret = 0;
          ^
3026.     char type_in, type_out;
3027.     const char *istream_spec = NULL, *ostream_spec = NULL;

avconv.c:3027:5: 
3025.     int i, ret = 0;
3026.     char type_in, type_out;
3027.     const char *istream_spec = NULL, *ostream_spec = NULL;
          ^
3028.     int idx_in = 0, idx_out = 0;
3029. 

avconv.c:3028:5: 
3026.     char type_in, type_out;
3027.     const char *istream_spec = NULL, *ostream_spec = NULL;
3028.     int idx_in = 0, idx_out = 0;
          ^
3029. 
3030.     parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);

avconv.c:3030:5: 
3028.     int idx_in = 0, idx_out = 0;
3029. 
3030.     parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);
          ^
3031.     parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3032. 

avconv.c:2994:1: start of procedure parse_meta_type()
  2992.  * @param stream_spec for type s, the stream specifier is written here
  2993.  */
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
        ^
  2995. {
  2996.     if (*arg) {

avconv.c:2996:9: Taking true branch
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
  2995. {
  2996.     if (*arg) {
                ^
  2997.         *type = *arg;
  2998.         switch (*arg) {

avconv.c:2997:9: 
  2995. {
  2996.     if (*arg) {
  2997.         *type = *arg;
                ^
  2998.         switch (*arg) {
  2999.         case 'g':

avconv.c:2998:9: 
  2996.     if (*arg) {
  2997.         *type = *arg;
  2998.         switch (*arg) {
                ^
  2999.         case 'g':
  3000.             break;

avconv.c:2999:9: Switch condition is false. Skipping switch case
  2997.         *type = *arg;
  2998.         switch (*arg) {
  2999.         case 'g':
                ^
  3000.             break;
  3001.         case 's':

avconv.c:3001:9: Switch condition is false. Skipping switch case
  2999.         case 'g':
  3000.             break;
  3001.         case 's':
                ^
  3002.             if (*(++arg) && *arg != ':') {
  3003.                 av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);

avconv.c:3008:9: Switch condition is false. Skipping switch case
  3006.             *stream_spec = *arg == ':' ? arg + 1 : "";
  3007.             break;
  3008.         case 'c':
                ^
  3009.         case 'p':
  3010.             if (*(++arg) == ':')

avconv.c:3009:9: Switch condition is false. Skipping switch case
  3007.             break;
  3008.         case 'c':
  3009.         case 'p':
                ^
  3010.             if (*(++arg) == ':')
  3011.                 *index = strtol(++arg, NULL, 0);

avconv.c:3014:13: Skipping av_log(): empty list of specs
  3012.             break;
  3013.         default:
  3014.             av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
                    ^
  3015.             exit_program(1);
  3016.         }

avconv.c:3015:13: Skipping exit_program(): empty list of specs
  3013.         default:
  3014.             av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
  3015.             exit_program(1);
                    ^
  3016.         }
  3017.     } else

avconv.c:2996:5: 
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
  2995. {
  2996.     if (*arg) {
            ^
  2997.         *type = *arg;
  2998.         switch (*arg) {

avconv.c:3019:1: return from a call to parse_meta_type
  3017.     } else
  3018.         *type = 'g';
  3019. }
        ^
  3020. 
  3021. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)

avconv.c:3031:5: 
3029. 
3030.     parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);
3031.     parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
          ^
3032. 
3033.     if (type_in == 'g' || type_out == 'g')

avconv.c:2994:1: start of procedure parse_meta_type()
  2992.  * @param stream_spec for type s, the stream specifier is written here
  2993.  */
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
        ^
  2995. {
  2996.     if (*arg) {

avconv.c:2996:9: Taking true branch
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
  2995. {
  2996.     if (*arg) {
                ^
  2997.         *type = *arg;
  2998.         switch (*arg) {

avconv.c:2997:9: 
  2995. {
  2996.     if (*arg) {
  2997.         *type = *arg;
                ^
  2998.         switch (*arg) {
  2999.         case 'g':

avconv.c:2998:9: 
  2996.     if (*arg) {
  2997.         *type = *arg;
  2998.         switch (*arg) {
                ^
  2999.         case 'g':
  3000.             break;

avconv.c:2999:9: Switch condition is false. Skipping switch case
  2997.         *type = *arg;
  2998.         switch (*arg) {
  2999.         case 'g':
                ^
  3000.             break;
  3001.         case 's':

avconv.c:3001:9: Switch condition is false. Skipping switch case
  2999.         case 'g':
  3000.             break;
  3001.         case 's':
                ^
  3002.             if (*(++arg) && *arg != ':') {
  3003.                 av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", arg);

avconv.c:3008:9: Switch condition is false. Skipping switch case
  3006.             *stream_spec = *arg == ':' ? arg + 1 : "";
  3007.             break;
  3008.         case 'c':
                ^
  3009.         case 'p':
  3010.             if (*(++arg) == ':')

avconv.c:3009:9: Switch condition is false. Skipping switch case
  3007.             break;
  3008.         case 'c':
  3009.         case 'p':
                ^
  3010.             if (*(++arg) == ':')
  3011.                 *index = strtol(++arg, NULL, 0);

avconv.c:3014:13: Skipping av_log(): empty list of specs
  3012.             break;
  3013.         default:
  3014.             av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
                    ^
  3015.             exit_program(1);
  3016.         }

avconv.c:3015:13: Skipping exit_program(): empty list of specs
  3013.         default:
  3014.             av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\n", *arg);
  3015.             exit_program(1);
                    ^
  3016.         }
  3017.     } else

avconv.c:2996:5: 
  2994. static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)
  2995. {
  2996.     if (*arg) {
            ^
  2997.         *type = *arg;
  2998.         switch (*arg) {

avconv.c:3019:1: return from a call to parse_meta_type
  3017.     } else
  3018.         *type = 'g';
  3019. }
        ^
  3020. 
  3021. static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)

avconv.c:3033:9: Taking false branch
3031.     parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3032. 
3033.     if (type_in == 'g' || type_out == 'g')
              ^
3034.         o->metadata_global_manual = 1;
3035.     if (type_in == 's' || type_out == 's')

avconv.c:3033:27: Taking false branch
3031.     parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
3032. 
3033.     if (type_in == 'g' || type_out == 'g')
                                ^
3034.         o->metadata_global_manual = 1;
3035.     if (type_in == 's' || type_out == 's')

avconv.c:3035:9: Taking false branch
3033.     if (type_in == 'g' || type_out == 'g')
3034.         o->metadata_global_manual = 1;
3035.     if (type_in == 's' || type_out == 's')
              ^
3036.         o->metadata_streams_manual = 1;
3037.     if (type_in == 'c' || type_out == 'c')

avconv.c:3035:27: Taking false branch
3033.     if (type_in == 'g' || type_out == 'g')
3034.         o->metadata_global_manual = 1;
3035.     if (type_in == 's' || type_out == 's')
                                ^
3036.         o->metadata_streams_manual = 1;
3037.     if (type_in == 'c' || type_out == 'c')

avconv.c:3037:9: Taking false branch
3035.     if (type_in == 's' || type_out == 's')
3036.         o->metadata_streams_manual = 1;
3037.     if (type_in == 'c' || type_out == 'c')
              ^
3038.         o->metadata_chapters_manual = 1;
3039. 

avconv.c:3037:27: Taking false branch
3035.     if (type_in == 's' || type_out == 's')
3036.         o->metadata_streams_manual = 1;
3037.     if (type_in == 'c' || type_out == 'c')
                                ^
3038.         o->metadata_chapters_manual = 1;
3039. 

avconv.c:3062:5: Switch condition is false. Skipping switch case
3060.         }\
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
          ^
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
3064. 

avconv.c:3062:5: Switch condition is false. Skipping switch case
3060.         }\
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
          ^
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
3064. 

avconv.c:3062:5: Switch condition is false. Skipping switch case
3060.         }\
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
          ^
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
3064. 

avconv.c:3063:5: Switch condition is false. Skipping switch case
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
          ^
3064. 
3065.     /* for input streams choose first matching stream */

avconv.c:3063:5: Switch condition is false. Skipping switch case
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
          ^
3064. 
3065.     /* for input streams choose first matching stream */

avconv.c:3063:5: Switch condition is false. Skipping switch case
3061. 
3062.     SET_DICT(type_in, meta_in, ic, idx_in);
3063.     SET_DICT(type_out, meta_out, oc, idx_out);
          ^
3064. 
3065.     /* for input streams choose first matching stream */

avconv.c:3066:9: Taking false branch
3064. 
3065.     /* for input streams choose first matching stream */
3066.     if (type_in == 's') {
              ^
3067.         for (i = 0; i < ic->nb_streams; i++) {
3068.             if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {

avconv.c:3080:9: Taking false branch
3078.     }
3079. 
3080.     if (type_out == 's') {
              ^
3081.         for (i = 0; i < oc->nb_streams; i++) {
3082.             if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {

avconv.c:3089:9: 
3087.         }
3088.     } else
3089.         av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
              ^
3090. 
3091.     return 0;

static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
{
    AVDictionary **meta_in = NULL;
    AVDictionary **meta_out;
    int i, ret = 0;
    char type_in, type_out;
    const char *istream_spec = NULL, *ostream_spec = NULL;
    int idx_in = 0, idx_out = 0;
    parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);
    parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);
    if (type_in == 'g' || type_out == 'g')
        o->metadata_global_manual = 1;
    if (type_in == 's' || type_out == 's')
        o->metadata_streams_manual = 1;
    if (type_in == 'c' || type_out == 'c')
        o->metadata_chapters_manual = 1;
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
    if ((index) < 0 || (index) >= (nb_elems)) {\
        av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
                (desc), (index));\
        exit_program(1);\
    }
#define SET_DICT(type, meta, context, index)\
        switch (type) {\
        case 'g':\
            meta = &context->metadata;\
            break;\
        case 'c':\
            METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
            meta = &context->chapters[index]->metadata;\
            break;\
        case 'p':\
            METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
            meta = &context->programs[index]->metadata;\
            break;\
        }\
    SET_DICT(type_in, meta_in, ic, idx_in);
    SET_DICT(type_out, meta_out, oc, idx_out);
    if (type_in == 's') {
        for (i = 0; i < ic->nb_streams; i++) {
            if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {
                meta_in = &ic->streams[i]->metadata;
                break;
            } else if (ret < 0)
                exit_program(1);
        }
        if (!meta_in) {
            av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match  any streams.\n", istream_spec);
            exit_program(1);
        }
    }
    if (type_out == 's') {
        for (i = 0; i < oc->nb_streams; i++) {
            if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {
                meta_out = &oc->streams[i]->metadata;
                av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
            } else if (ret < 0)
                exit_program(1);
        }
    } else
        av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);
    return 0;
}
['static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)\n{\n    AVDictionary **meta_in = NULL;\n    AVDictionary **meta_out;\n    int i, ret = 0;\n    char type_in, type_out;\n    const char *istream_spec = NULL, *ostream_spec = NULL;\n    int idx_in = 0, idx_out = 0;\n    parse_meta_type(inspec,  &type_in,  &idx_in,  &istream_spec);\n    parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec);\n    if (type_in == \'g\' || type_out == \'g\')\n        o->metadata_global_manual = 1;\n    if (type_in == \'s\' || type_out == \'s\')\n        o->metadata_streams_manual = 1;\n    if (type_in == \'c\' || type_out == \'c\')\n        o->metadata_chapters_manual = 1;\n#define METADATA_CHECK_INDEX(index, nb_elems, desc)\\\n    if ((index) < 0 || (index) >= (nb_elems)) {\\\n        av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\\n",\\\n                (desc), (index));\\\n        exit_program(1);\\\n    }\n#define SET_DICT(type, meta, context, index)\\\n        switch (type) {\\\n        case \'g\':\\\n            meta = &context->metadata;\\\n            break;\\\n        case \'c\':\\\n            METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\\\n            meta = &context->chapters[index]->metadata;\\\n            break;\\\n        case \'p\':\\\n            METADATA_CHECK_INDEX(index, context->nb_programs, "program")\\\n            meta = &context->programs[index]->metadata;\\\n            break;\\\n        }\\\n    SET_DICT(type_in, meta_in, ic, idx_in);\n    SET_DICT(type_out, meta_out, oc, idx_out);\n    if (type_in == \'s\') {\n        for (i = 0; i < ic->nb_streams; i++) {\n            if ((ret = check_stream_specifier(ic, ic->streams[i], istream_spec)) > 0) {\n                meta_in = &ic->streams[i]->metadata;\n                break;\n            } else if (ret < 0)\n                exit_program(1);\n        }\n        if (!meta_in) {\n            av_log(NULL, AV_LOG_FATAL, "Stream specifier %s does not match  any streams.\\n", istream_spec);\n            exit_program(1);\n        }\n    }\n    if (type_out == \'s\') {\n        for (i = 0; i < oc->nb_streams; i++) {\n            if ((ret = check_stream_specifier(oc, oc->streams[i], ostream_spec)) > 0) {\n                meta_out = &oc->streams[i]->metadata;\n                av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);\n            } else if (ret < 0)\n                exit_program(1);\n        }\n    } else\n        av_dict_copy(meta_out, *meta_in, AV_DICT_DONT_OVERWRITE);\n    return 0;\n}', 'static void parse_meta_type(char *arg, char *type, int *index, const char **stream_spec)\n{\n    if (*arg) {\n        *type = *arg;\n        switch (*arg) {\n        case \'g\':\n            break;\n        case \'s\':\n            if (*(++arg) && *arg != \':\') {\n                av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\\n", arg);\n                exit_program(1);\n            }\n            *stream_spec = *arg == \':\' ? arg + 1 : "";\n            break;\n        case \'c\':\n        case \'p\':\n            if (*(++arg) == \':\')\n                *index = strtol(++arg, NULL, 0);\n            break;\n        default:\n            av_log(NULL, AV_LOG_FATAL, "Invalid metadata type %c.\\n", *arg);\n            exit_program(1);\n        }\n    } else\n        *type = \'g\';\n}']