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

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

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

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

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

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

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

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

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

ffmpeg.c:518:1: start of procedure grow_array()
  516. 
  517. /* similar to ff_dynarray_add() and av_fast_realloc() */
  518. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  519. {
  520.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:520:9: Taking false branch
  518. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  519. {
  520.     if (new_size >= INT_MAX / elem_size) {
               ^
  521.         fprintf(stderr, "Array too big.\n");
  522.         ffmpeg_exit(1);

ffmpeg.c:524:9: Taking true branch
  522.         ffmpeg_exit(1);
  523.     }
  524.     if (*size < new_size) {
               ^
  525.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  526.         if (!tmp) {

ffmpeg.c:525:9: 
  523.     }
  524.     if (*size < new_size) {
  525.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  526.         if (!tmp) {
  527.             fprintf(stderr, "Could not alloc buffer.\n");

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

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

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

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

ffmpeg.c:526:14: Taking true branch
  524.     if (*size < new_size) {
  525.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  526.         if (!tmp) {
                    ^
  527.             fprintf(stderr, "Could not alloc buffer.\n");
  528.             ffmpeg_exit(1);

ffmpeg.c:527:13: 
  525.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  526.         if (!tmp) {
  527.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  528.             ffmpeg_exit(1);
  529.         }

ffmpeg.c:528:13: Skipping ffmpeg_exit(): empty list of specs
  526.         if (!tmp) {
  527.             fprintf(stderr, "Could not alloc buffer.\n");
  528.             ffmpeg_exit(1);
                   ^
  529.         }
  530.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:530:9: 
  528.             ffmpeg_exit(1);
  529.         }
  530.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  531.         *size = new_size;
  532.         return tmp;

ffmpeg.c:531:9: 
  529.         }
  530.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  531.         *size = new_size;
               ^
  532.         return tmp;
  533.     }

ffmpeg.c:532:9: 
  530.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  531.         *size = new_size;
  532.         return tmp;
               ^
  533.     }
  534.     return array;

ffmpeg.c:535:1: return from a call to grow_array
  533.     }
  534.     return array;
  535. }
       ^
  536. 
  537. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

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