ffmpeg.c:3677: error: Null Dereference
  pointer `streamid_map` last assigned on line 3676 could be null and is dereferenced at line 3677, column 5.

ffmpeg.c:3659:1: start of procedure opt_streamid()
3657. 
3658. /* arg format is "output-stream-index:streamid-value". */
3659. static int opt_streamid(const char *opt, const char *arg)
      ^
3660. {
3661.     int idx;

ffmpeg.c:3665:5: 
3663.     char idx_str[16];
3664. 
3665.     strncpy(idx_str, arg, sizeof(idx_str));
          ^
3666.     idx_str[sizeof(idx_str)-1] = '\0';
3667.     p = strchr(idx_str, ':');

ffmpeg.c:3666:5: 
3664. 
3665.     strncpy(idx_str, arg, sizeof(idx_str));
3666.     idx_str[sizeof(idx_str)-1] = '\0';
          ^
3667.     p = strchr(idx_str, ':');
3668.     if (!p) {

ffmpeg.c:3667:5: 
3665.     strncpy(idx_str, arg, sizeof(idx_str));
3666.     idx_str[sizeof(idx_str)-1] = '\0';
3667.     p = strchr(idx_str, ':');
          ^
3668.     if (!p) {
3669.         fprintf(stderr,

ffmpeg.c:3668:10: Taking false branch
3666.     idx_str[sizeof(idx_str)-1] = '\0';
3667.     p = strchr(idx_str, ':');
3668.     if (!p) {
               ^
3669.         fprintf(stderr,
3670.                 "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",

ffmpeg.c:3674:5: 
3672.         ffmpeg_exit(1);
3673.     }
3674.     *p++ = '\0';
          ^
3675.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3676.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);

ffmpeg.c:3675:5: Skipping parse_number_or_die(): empty list of specs
3673.     }
3674.     *p++ = '\0';
3675.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
          ^
3676.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3677.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

ffmpeg.c:3676:5: 
3674.     *p++ = '\0';
3675.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3676.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
          ^
3677.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
3678.     return 0;

ffmpeg.c:561:1: start of procedure grow_array()
  559. 
  560. /* similar to ff_dynarray_add() and av_fast_realloc() */
  561. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  562. {
  563.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:563:9: Taking false branch
  561. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  562. {
  563.     if (new_size >= INT_MAX / elem_size) {
               ^
  564.         fprintf(stderr, "Array too big.\n");
  565.         ffmpeg_exit(1);

ffmpeg.c:567:9: Taking true branch
  565.         ffmpeg_exit(1);
  566.     }
  567.     if (*size < new_size) {
               ^
  568.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  569.         if (!tmp) {

ffmpeg.c:568:9: 
  566.     }
  567.     if (*size < new_size) {
  568.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  569.         if (!tmp) {
  570.             fprintf(stderr, "Could not alloc buffer.\n");

libavutil/mem.c:119:1: start of procedure av_realloc()
    117. }
    118. 
    119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
         ^
    120. {
    121. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:126:8: Taking true branch
    124. 
    125.     /* let's disallow possible ambiguous cases */
    126.     if(size > (INT_MAX-16) )
                ^
    127.         return NULL;
    128. 

libavutil/mem.c:127:9: 
    125.     /* let's disallow possible ambiguous cases */
    126.     if(size > (INT_MAX-16) )
    127.         return NULL;
                 ^
    128. 
    129. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:137:1: return from a call to av_realloc
    135.     return realloc(ptr, size);
    136. #endif
    137. }
         ^
    138. 
    139. void av_free(void *ptr)

ffmpeg.c:569:14: Taking true branch
  567.     if (*size < new_size) {
  568.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  569.         if (!tmp) {
                    ^
  570.             fprintf(stderr, "Could not alloc buffer.\n");
  571.             ffmpeg_exit(1);

ffmpeg.c:570:13: 
  568.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  569.         if (!tmp) {
  570.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  571.             ffmpeg_exit(1);
  572.         }

ffmpeg.c:571:13: Skipping ffmpeg_exit(): empty list of specs
  569.         if (!tmp) {
  570.             fprintf(stderr, "Could not alloc buffer.\n");
  571.             ffmpeg_exit(1);
                   ^
  572.         }
  573.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:573:9: 
  571.             ffmpeg_exit(1);
  572.         }
  573.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  574.         *size = new_size;
  575.         return tmp;

ffmpeg.c:574:9: 
  572.         }
  573.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  574.         *size = new_size;
               ^
  575.         return tmp;
  576.     }

ffmpeg.c:575:9: 
  573.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  574.         *size = new_size;
  575.         return tmp;
               ^
  576.     }
  577.     return array;

ffmpeg.c:578:1: return from a call to grow_array
  576.     }
  577.     return array;
  578. }
       ^
  579. 
  580. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3677:5: Skipping parse_number_or_die(): empty list of specs
3675.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3676.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3677.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
          ^
3678.     return 0;
3679. }
