ffmpeg.c:3090: error: Null Dereference
  pointer `ts_scale` last assigned on line 3089 could be null and is dereferenced at line 3090, column 5.

ffmpeg.c:3075:1: start of procedure opt_input_ts_scale()
3073. }
3074. 
3075. static int opt_input_ts_scale(const char *opt, const char *arg)
      ^
3076. {
3077.     unsigned int stream;

ffmpeg.c:3081:5: 
3079.     char *p;
3080. 
3081.     stream = strtol(arg, &p, 0);
          ^
3082.     if (*p)
3083.         p++;

ffmpeg.c:3082:9: Taking false branch
3080. 
3081.     stream = strtol(arg, &p, 0);
3082.     if (*p)
              ^
3083.         p++;
3084.     scale= strtod(p, &p);

ffmpeg.c:3084:5: 
3082.     if (*p)
3083.         p++;
3084.     scale= strtod(p, &p);
          ^
3085. 
3086.     if(stream >= MAX_STREAMS)

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

ffmpeg.c:3087:9: Skipping ffmpeg_exit(): empty list of specs
3085. 
3086.     if(stream >= MAX_STREAMS)
3087.         ffmpeg_exit(1);
              ^
3088. 
3089.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);

ffmpeg.c:3089:5: 
3087.         ffmpeg_exit(1);
3088. 
3089.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
          ^
3090.     ts_scale[stream] = scale;
3091.     return 0;

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

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

ffmpeg.c:519:9: 
  517. {
  518.     if (new_size >= INT_MAX / elem_size) {
  519.         fprintf(stderr, "Array too big.\n");
               ^
  520.         ffmpeg_exit(1);
  521.     }

ffmpeg.c:520:9: Skipping ffmpeg_exit(): empty list of specs
  518.     if (new_size >= INT_MAX / elem_size) {
  519.         fprintf(stderr, "Array too big.\n");
  520.         ffmpeg_exit(1);
               ^
  521.     }
  522.     if (*size < new_size) {

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

ffmpeg.c:523:9: 
  521.     }
  522.     if (*size < new_size) {
  523.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  524.         if (!tmp) {
  525.             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:524:14: Taking true branch
  522.     if (*size < new_size) {
  523.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  524.         if (!tmp) {
                    ^
  525.             fprintf(stderr, "Could not alloc buffer.\n");
  526.             ffmpeg_exit(1);

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

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

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

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

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

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

ffmpeg.c:3090:5: 
3088. 
3089.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
3090.     ts_scale[stream] = scale;
          ^
3091.     return 0;
3092. }

static int opt_input_ts_scale(const char *opt, 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);
    ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
    ts_scale[stream] = scale;
    return 0;
}
['static int opt_input_ts_scale(const char *opt, 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    ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);\n    ts_scale[stream] = scale;\n    return 0;\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}']