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

ffmpeg.c:3008:1: start of procedure opt_input_ts_scale()
3006. }
3007. 
3008. static void opt_input_ts_scale(const char *arg)
      ^
3009. {
3010.     unsigned int stream;

ffmpeg.c:3014:5: 
3012.     char *p;
3013. 
3014.     stream = strtol(arg, &p, 0);
          ^
3015.     if (*p)
3016.         p++;

ffmpeg.c:3015:9: Taking true branch
3013. 
3014.     stream = strtol(arg, &p, 0);
3015.     if (*p)
              ^
3016.         p++;
3017.     scale= strtod(p, &p);

ffmpeg.c:3016:9: 
3014.     stream = strtol(arg, &p, 0);
3015.     if (*p)
3016.         p++;
              ^
3017.     scale= strtod(p, &p);
3018. 

ffmpeg.c:3017:5: 
3015.     if (*p)
3016.         p++;
3017.     scale= strtod(p, &p);
          ^
3018. 
3019.     if(stream >= MAX_STREAMS)

ffmpeg.c:3019:8: Taking true branch
3017.     scale= strtod(p, &p);
3018. 
3019.     if(stream >= MAX_STREAMS)
             ^
3020.         ffmpeg_exit(1);
3021. 

ffmpeg.c:3020:9: Skipping ffmpeg_exit(): empty list of specs
3018. 
3019.     if(stream >= MAX_STREAMS)
3020.         ffmpeg_exit(1);
              ^
3021. 
3022.     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:3022:5: 
3020.         ffmpeg_exit(1);
3021. 
3022.     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);
          ^
3023.     input_files_ts_scale[nb_input_files][stream]= scale;
3024. }

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

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

ffmpeg.c:510:9: 
  508. {
  509.     if (new_size >= INT_MAX / elem_size) {
  510.         fprintf(stderr, "Array too big.\n");
               ^
  511.         ffmpeg_exit(1);
  512.     }

ffmpeg.c:511:9: Skipping ffmpeg_exit(): empty list of specs
  509.     if (new_size >= INT_MAX / elem_size) {
  510.         fprintf(stderr, "Array too big.\n");
  511.         ffmpeg_exit(1);
               ^
  512.     }
  513.     if (*size < new_size) {

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

ffmpeg.c:514:9: 
  512.     }
  513.     if (*size < new_size) {
  514.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  515.         if (!tmp) {
  516.             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 false branch
    122. 
    123.     /* let's disallow possible ambiguous cases */
    124.     if(size > (INT_MAX-16) )
                ^
    125.         return NULL;
    126. 

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

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

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

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

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

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

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

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

ffmpeg.c:3023:5: 
3021. 
3022.     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);
3023.     input_files_ts_scale[nb_input_files][stream]= scale;
          ^
3024. }
3025. 

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