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

ffmpeg.c:3649:1: start of procedure opt_streamid()
3647. 
3648. /* arg format is "output-stream-index:streamid-value". */
3649. static int opt_streamid(const char *opt, const char *arg)
      ^
3650. {
3651.     int idx;

ffmpeg.c:3655:5: 
3653.     char idx_str[16];
3654. 
3655.     strncpy(idx_str, arg, sizeof(idx_str));
          ^
3656.     idx_str[sizeof(idx_str)-1] = '\0';
3657.     p = strchr(idx_str, ':');

ffmpeg.c:3656:5: 
3654. 
3655.     strncpy(idx_str, arg, sizeof(idx_str));
3656.     idx_str[sizeof(idx_str)-1] = '\0';
          ^
3657.     p = strchr(idx_str, ':');
3658.     if (!p) {

ffmpeg.c:3657:5: 
3655.     strncpy(idx_str, arg, sizeof(idx_str));
3656.     idx_str[sizeof(idx_str)-1] = '\0';
3657.     p = strchr(idx_str, ':');
          ^
3658.     if (!p) {
3659.         fprintf(stderr,

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

ffmpeg.c:3664:5: 
3662.         ffmpeg_exit(1);
3663.     }
3664.     *p++ = '\0';
          ^
3665.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3666.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);

ffmpeg.c:3665:5: Skipping parse_number_or_die(): empty list of specs
3663.     }
3664.     *p++ = '\0';
3665.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
          ^
3666.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3667.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

ffmpeg.c:3666:5: 
3664.     *p++ = '\0';
3665.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3666.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
          ^
3667.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
3668.     return 0;

ffmpeg.c:620:1: start of procedure grow_array()
  618. 
  619. /* similar to ff_dynarray_add() and av_fast_realloc() */
  620. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  621. {
  622.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:622:9: Taking false branch
  620. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  621. {
  622.     if (new_size >= INT_MAX / elem_size) {
               ^
  623.         fprintf(stderr, "Array too big.\n");
  624.         ffmpeg_exit(1);

ffmpeg.c:626:9: Taking true branch
  624.         ffmpeg_exit(1);
  625.     }
  626.     if (*size < new_size) {
               ^
  627.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  628.         if (!tmp) {

ffmpeg.c:627:9: 
  625.     }
  626.     if (*size < new_size) {
  627.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  628.         if (!tmp) {
  629.             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:628:14: Taking true branch
  626.     if (*size < new_size) {
  627.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  628.         if (!tmp) {
                    ^
  629.             fprintf(stderr, "Could not alloc buffer.\n");
  630.             ffmpeg_exit(1);

ffmpeg.c:629:13: 
  627.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  628.         if (!tmp) {
  629.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  630.             ffmpeg_exit(1);
  631.         }

ffmpeg.c:630:13: Skipping ffmpeg_exit(): empty list of specs
  628.         if (!tmp) {
  629.             fprintf(stderr, "Could not alloc buffer.\n");
  630.             ffmpeg_exit(1);
                   ^
  631.         }
  632.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:632:9: 
  630.             ffmpeg_exit(1);
  631.         }
  632.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  633.         *size = new_size;
  634.         return tmp;

ffmpeg.c:633:9: 
  631.         }
  632.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  633.         *size = new_size;
               ^
  634.         return tmp;
  635.     }

ffmpeg.c:634:9: 
  632.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  633.         *size = new_size;
  634.         return tmp;
               ^
  635.     }
  636.     return array;

ffmpeg.c:637:1: return from a call to grow_array
  635.     }
  636.     return array;
  637. }
       ^
  638. 
  639. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3667:5: Skipping parse_number_or_die(): empty list of specs
3665.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3666.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3667.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
          ^
3668.     return 0;
3669. }
