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

ffmpeg.c:3630:1: start of procedure opt_streamid()
3628. 
3629. /* arg format is "output-stream-index:streamid-value". */
3630. static int opt_streamid(const char *opt, const char *arg)
      ^
3631. {
3632.     int idx;

ffmpeg.c:3636:5: 
3634.     char idx_str[16];
3635. 
3636.     strncpy(idx_str, arg, sizeof(idx_str));
          ^
3637.     idx_str[sizeof(idx_str)-1] = '\0';
3638.     p = strchr(idx_str, ':');

ffmpeg.c:3637:5: 
3635. 
3636.     strncpy(idx_str, arg, sizeof(idx_str));
3637.     idx_str[sizeof(idx_str)-1] = '\0';
          ^
3638.     p = strchr(idx_str, ':');
3639.     if (!p) {

ffmpeg.c:3638:5: 
3636.     strncpy(idx_str, arg, sizeof(idx_str));
3637.     idx_str[sizeof(idx_str)-1] = '\0';
3638.     p = strchr(idx_str, ':');
          ^
3639.     if (!p) {
3640.         fprintf(stderr,

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

ffmpeg.c:3645:5: 
3643.         ffmpeg_exit(1);
3644.     }
3645.     *p++ = '\0';
          ^
3646.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3647.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);

ffmpeg.c:3646:5: Skipping parse_number_or_die(): empty list of specs
3644.     }
3645.     *p++ = '\0';
3646.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
          ^
3647.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3648.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

ffmpeg.c:3647:5: 
3645.     *p++ = '\0';
3646.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3647.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
          ^
3648.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
3649.     return 0;

ffmpeg.c:579:1: start of procedure grow_array()
  577. 
  578. /* similar to ff_dynarray_add() and av_fast_realloc() */
  579. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  580. {
  581.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:581:9: Taking false branch
  579. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  580. {
  581.     if (new_size >= INT_MAX / elem_size) {
               ^
  582.         fprintf(stderr, "Array too big.\n");
  583.         ffmpeg_exit(1);

ffmpeg.c:585:9: Taking true branch
  583.         ffmpeg_exit(1);
  584.     }
  585.     if (*size < new_size) {
               ^
  586.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  587.         if (!tmp) {

ffmpeg.c:586:9: 
  584.     }
  585.     if (*size < new_size) {
  586.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  587.         if (!tmp) {
  588.             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, unsigned int 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:587:14: Taking true branch
  585.     if (*size < new_size) {
  586.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  587.         if (!tmp) {
                    ^
  588.             fprintf(stderr, "Could not alloc buffer.\n");
  589.             ffmpeg_exit(1);

ffmpeg.c:588:13: 
  586.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  587.         if (!tmp) {
  588.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  589.             ffmpeg_exit(1);
  590.         }

ffmpeg.c:589:13: Skipping ffmpeg_exit(): empty list of specs
  587.         if (!tmp) {
  588.             fprintf(stderr, "Could not alloc buffer.\n");
  589.             ffmpeg_exit(1);
                   ^
  590.         }
  591.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:591:9: 
  589.             ffmpeg_exit(1);
  590.         }
  591.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  592.         *size = new_size;
  593.         return tmp;

ffmpeg.c:592:9: 
  590.         }
  591.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  592.         *size = new_size;
               ^
  593.         return tmp;
  594.     }

ffmpeg.c:593:9: 
  591.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  592.         *size = new_size;
  593.         return tmp;
               ^
  594.     }
  595.     return array;

ffmpeg.c:596:1: return from a call to grow_array
  594.     }
  595.     return array;
  596. }
       ^
  597. 
  598. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3648:5: Skipping parse_number_or_die(): empty list of specs
3646.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3647.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3648.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
          ^
3649.     return 0;
3650. }
