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

ffmpeg.c:3620:1: start of procedure opt_streamid()
3618. 
3619. /* arg format is "output-stream-index:streamid-value". */
3620. static int opt_streamid(const char *opt, const char *arg)
      ^
3621. {
3622.     int idx;

ffmpeg.c:3626:5: 
3624.     char idx_str[16];
3625. 
3626.     strncpy(idx_str, arg, sizeof(idx_str));
          ^
3627.     idx_str[sizeof(idx_str)-1] = '\0';
3628.     p = strchr(idx_str, ':');

ffmpeg.c:3627:5: 
3625. 
3626.     strncpy(idx_str, arg, sizeof(idx_str));
3627.     idx_str[sizeof(idx_str)-1] = '\0';
          ^
3628.     p = strchr(idx_str, ':');
3629.     if (!p) {

ffmpeg.c:3628:5: 
3626.     strncpy(idx_str, arg, sizeof(idx_str));
3627.     idx_str[sizeof(idx_str)-1] = '\0';
3628.     p = strchr(idx_str, ':');
          ^
3629.     if (!p) {
3630.         fprintf(stderr,

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

ffmpeg.c:3635:5: 
3633.         ffmpeg_exit(1);
3634.     }
3635.     *p++ = '\0';
          ^
3636.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3637.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);

ffmpeg.c:3636:5: Skipping parse_number_or_die(): empty list of specs
3634.     }
3635.     *p++ = '\0';
3636.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
          ^
3637.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3638.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

ffmpeg.c:3637:5: 
3635.     *p++ = '\0';
3636.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3637.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
          ^
3638.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
3639.     return 0;

ffmpeg.c:508:1: start of procedure grow_array()
  506. 
  507. /* similar to ff_dynarray_add() and av_fast_realloc() */
  508. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  509. {
  510.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:510:9: Taking false branch
  508. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  509. {
  510.     if (new_size >= INT_MAX / elem_size) {
               ^
  511.         fprintf(stderr, "Array too big.\n");
  512.         ffmpeg_exit(1);

ffmpeg.c:514:9: Taking true branch
  512.         ffmpeg_exit(1);
  513.     }
  514.     if (*size < new_size) {
               ^
  515.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  516.         if (!tmp) {

ffmpeg.c:515:9: 
  513.     }
  514.     if (*size < new_size) {
  515.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  516.         if (!tmp) {
  517.             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:516:14: Taking true branch
  514.     if (*size < new_size) {
  515.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  516.         if (!tmp) {
                    ^
  517.             fprintf(stderr, "Could not alloc buffer.\n");
  518.             ffmpeg_exit(1);

ffmpeg.c:517:13: 
  515.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  516.         if (!tmp) {
  517.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  518.             ffmpeg_exit(1);
  519.         }

ffmpeg.c:518:13: Skipping ffmpeg_exit(): empty list of specs
  516.         if (!tmp) {
  517.             fprintf(stderr, "Could not alloc buffer.\n");
  518.             ffmpeg_exit(1);
                   ^
  519.         }
  520.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:520:9: 
  518.             ffmpeg_exit(1);
  519.         }
  520.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  521.         *size = new_size;
  522.         return tmp;

ffmpeg.c:521:9: 
  519.         }
  520.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  521.         *size = new_size;
               ^
  522.         return tmp;
  523.     }

ffmpeg.c:522:9: 
  520.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  521.         *size = new_size;
  522.         return tmp;
               ^
  523.     }
  524.     return array;

ffmpeg.c:525:1: return from a call to grow_array
  523.     }
  524.     return array;
  525. }
       ^
  526. 
  527. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3638:5: Skipping parse_number_or_die(): empty list of specs
3636.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
3637.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3638.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
          ^
3639.     return 0;
3640. }
