ffmpeg.c:3087: error: Null Dereference
  pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3086 could be null and is dereferenced at line 3087, column 5.

ffmpeg.c:3072:1: start of procedure opt_input_ts_scale()
3070. }
3071. 
3072. static void opt_input_ts_scale(const char *arg)
      ^
3073. {
3074.     unsigned int stream;

ffmpeg.c:3078:5: 
3076.     char *p;
3077. 
3078.     stream = strtol(arg, &p, 0);
          ^
3079.     if (*p)
3080.         p++;

ffmpeg.c:3079:9: Taking true branch
3077. 
3078.     stream = strtol(arg, &p, 0);
3079.     if (*p)
              ^
3080.         p++;
3081.     scale= strtod(p, &p);

ffmpeg.c:3080:9: 
3078.     stream = strtol(arg, &p, 0);
3079.     if (*p)
3080.         p++;
              ^
3081.     scale= strtod(p, &p);
3082. 

ffmpeg.c:3081:5: 
3079.     if (*p)
3080.         p++;
3081.     scale= strtod(p, &p);
          ^
3082. 
3083.     if(stream >= MAX_STREAMS)

ffmpeg.c:3083:8: Taking true branch
3081.     scale= strtod(p, &p);
3082. 
3083.     if(stream >= MAX_STREAMS)
             ^
3084.         ffmpeg_exit(1);
3085. 

ffmpeg.c:3084:9: Skipping ffmpeg_exit(): empty list of specs
3082. 
3083.     if(stream >= MAX_STREAMS)
3084.         ffmpeg_exit(1);
              ^
3085. 
3086.     input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);

ffmpeg.c:3086:5: 
3084.         ffmpeg_exit(1);
3085. 
3086.     input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
          ^
3087.     input_files_ts_scale[nb_input_files][stream]= scale;
3088. }

ffmpeg.c:661:1: start of procedure grow_array()
  659. 
  660. /* similar to ff_dynarray_add() and av_fast_realloc() */
  661. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  662. {
  663.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:663:9: Taking true branch
  661. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  662. {
  663.     if (new_size >= INT_MAX / elem_size) {
               ^
  664.         fprintf(stderr, "Array too big.\n");
  665.         ffmpeg_exit(1);

ffmpeg.c:664:9: 
  662. {
  663.     if (new_size >= INT_MAX / elem_size) {
  664.         fprintf(stderr, "Array too big.\n");
               ^
  665.         ffmpeg_exit(1);
  666.     }

ffmpeg.c:665:9: Skipping ffmpeg_exit(): empty list of specs
  663.     if (new_size >= INT_MAX / elem_size) {
  664.         fprintf(stderr, "Array too big.\n");
  665.         ffmpeg_exit(1);
               ^
  666.     }
  667.     if (*size < new_size) {

ffmpeg.c:667:9: Taking true branch
  665.         ffmpeg_exit(1);
  666.     }
  667.     if (*size < new_size) {
               ^
  668.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  669.         if (!tmp) {

ffmpeg.c:668:9: 
  666.     }
  667.     if (*size < new_size) {
  668.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  669.         if (!tmp) {
  670.             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 false branch
    124. 
    125.     /* let's disallow possible ambiguous cases */
    126.     if(size > (INT_MAX-16) )
                ^
    127.         return NULL;
    128. 

libavutil/mem.c:135:5: 
    133.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
    134. #else
    135.     return realloc(ptr, size);
             ^
    136. #endif
    137. }

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:669:14: Taking true branch
  667.     if (*size < new_size) {
  668.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  669.         if (!tmp) {
                    ^
  670.             fprintf(stderr, "Could not alloc buffer.\n");
  671.             ffmpeg_exit(1);

ffmpeg.c:670:13: 
  668.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  669.         if (!tmp) {
  670.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  671.             ffmpeg_exit(1);
  672.         }

ffmpeg.c:671:13: Skipping ffmpeg_exit(): empty list of specs
  669.         if (!tmp) {
  670.             fprintf(stderr, "Could not alloc buffer.\n");
  671.             ffmpeg_exit(1);
                   ^
  672.         }
  673.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:673:9: 
  671.             ffmpeg_exit(1);
  672.         }
  673.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  674.         *size = new_size;
  675.         return tmp;

ffmpeg.c:674:9: 
  672.         }
  673.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  674.         *size = new_size;
               ^
  675.         return tmp;
  676.     }

ffmpeg.c:675:9: 
  673.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  674.         *size = new_size;
  675.         return tmp;
               ^
  676.     }
  677.     return array;

ffmpeg.c:678:1: return from a call to grow_array
  676.     }
  677.     return array;
  678. }
       ^
  679. 
  680. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3087:5: 
3085. 
3086.     input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
3087.     input_files_ts_scale[nb_input_files][stream]= scale;
          ^
3088. }
3089. 

static void opt_input_ts_scale(const char *arg)
{
    unsigned int stream;
    double scale;
    char *p;
    stream = strtol(arg, &p, 0);
    if (*p)
        p++;
    scale= strtod(p, &p);
    if(stream >= MAX_STREAMS)
        ffmpeg_exit(1);
    input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
    input_files_ts_scale[nb_input_files][stream]= scale;
}
['static void opt_input_ts_scale(const char *arg)\n{\n    unsigned int stream;\n    double scale;\n    char *p;\n    stream = strtol(arg, &p, 0);\n    if (*p)\n        p++;\n    scale= strtod(p, &p);\n    if(stream >= MAX_STREAMS)\n        ffmpeg_exit(1);\n    input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);\n    input_files_ts_scale[nb_input_files][stream]= scale;\n}', 'static void *grow_array(void *array, int elem_size, int *size, int new_size)\n{\n    if (new_size >= INT_MAX / elem_size) {\n        fprintf(stderr, "Array too big.\\n");\n        ffmpeg_exit(1);\n    }\n    if (*size < new_size) {\n        uint8_t *tmp = av_realloc(array, new_size*elem_size);\n        if (!tmp) {\n            fprintf(stderr, "Could not alloc buffer.\\n");\n            ffmpeg_exit(1);\n        }\n        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);\n        *size = new_size;\n        return tmp;\n    }\n    return array;\n}', 'void *av_realloc(void *ptr, unsigned int size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if(!ptr) return av_malloc(size);\n    diff= ((char*)ptr)[-1];\n    return (char*)realloc((char*)ptr - diff, size + diff) + diff;\n#else\n    return realloc(ptr, size);\n#endif\n}']