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

ffmpeg.c:2963:1: start of procedure opt_input_ts_scale()
2961. }
2962. 
2963. static void opt_input_ts_scale(const char *arg)
      ^
2964. {
2965.     unsigned int stream;

ffmpeg.c:2969:5: 
2967.     char *p;
2968. 
2969.     stream = strtol(arg, &p, 0);
          ^
2970.     if (*p)
2971.         p++;

ffmpeg.c:2970:9: Taking true branch
2968. 
2969.     stream = strtol(arg, &p, 0);
2970.     if (*p)
              ^
2971.         p++;
2972.     scale= strtod(p, &p);

ffmpeg.c:2971:9: 
2969.     stream = strtol(arg, &p, 0);
2970.     if (*p)
2971.         p++;
              ^
2972.     scale= strtod(p, &p);
2973. 

ffmpeg.c:2972:5: 
2970.     if (*p)
2971.         p++;
2972.     scale= strtod(p, &p);
          ^
2973. 
2974.     if(stream >= MAX_STREAMS)

ffmpeg.c:2974:8: Taking true branch
2972.     scale= strtod(p, &p);
2973. 
2974.     if(stream >= MAX_STREAMS)
             ^
2975.         ffmpeg_exit(1);
2976. 

ffmpeg.c:2975:9: Skipping ffmpeg_exit(): empty list of specs
2973. 
2974.     if(stream >= MAX_STREAMS)
2975.         ffmpeg_exit(1);
              ^
2976. 
2977.     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:2977:5: 
2975.         ffmpeg_exit(1);
2976. 
2977.     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);
          ^
2978.     input_files_ts_scale[nb_input_files][stream]= scale;
2979. }

ffmpeg.c:570:1: start of procedure grow_array()
  568. 
  569. /* similar to ff_dynarray_add() and av_fast_realloc() */
  570. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  571. {
  572.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:572:9: Taking true branch
  570. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  571. {
  572.     if (new_size >= INT_MAX / elem_size) {
               ^
  573.         fprintf(stderr, "Array too big.\n");
  574.         ffmpeg_exit(1);

ffmpeg.c:573:9: 
  571. {
  572.     if (new_size >= INT_MAX / elem_size) {
  573.         fprintf(stderr, "Array too big.\n");
               ^
  574.         ffmpeg_exit(1);
  575.     }

ffmpeg.c:574:9: Skipping ffmpeg_exit(): empty list of specs
  572.     if (new_size >= INT_MAX / elem_size) {
  573.         fprintf(stderr, "Array too big.\n");
  574.         ffmpeg_exit(1);
               ^
  575.     }
  576.     if (*size < new_size) {

ffmpeg.c:576:9: Taking true branch
  574.         ffmpeg_exit(1);
  575.     }
  576.     if (*size < new_size) {
               ^
  577.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  578.         if (!tmp) {

ffmpeg.c:577:9: 
  575.     }
  576.     if (*size < new_size) {
  577.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  578.         if (!tmp) {
  579.             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:578:14: Taking true branch
  576.     if (*size < new_size) {
  577.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  578.         if (!tmp) {
                    ^
  579.             fprintf(stderr, "Could not alloc buffer.\n");
  580.             ffmpeg_exit(1);

ffmpeg.c:579:13: 
  577.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  578.         if (!tmp) {
  579.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  580.             ffmpeg_exit(1);
  581.         }

ffmpeg.c:580:13: Skipping ffmpeg_exit(): empty list of specs
  578.         if (!tmp) {
  579.             fprintf(stderr, "Could not alloc buffer.\n");
  580.             ffmpeg_exit(1);
                   ^
  581.         }
  582.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:582:9: 
  580.             ffmpeg_exit(1);
  581.         }
  582.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  583.         *size = new_size;
  584.         return tmp;

ffmpeg.c:583:9: 
  581.         }
  582.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  583.         *size = new_size;
               ^
  584.         return tmp;
  585.     }

ffmpeg.c:584:9: 
  582.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  583.         *size = new_size;
  584.         return tmp;
               ^
  585.     }
  586.     return array;

ffmpeg.c:587:1: return from a call to grow_array
  585.     }
  586.     return array;
  587. }
       ^
  588. 
  589. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:2978:5: 
2976. 
2977.     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);
2978.     input_files_ts_scale[nb_input_files][stream]= scale;
          ^
2979. }
2980. 

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}']