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

ffmpeg.c:3092:1: start of procedure opt_input_ts_scale()
3090. }
3091. 
3092. static int opt_input_ts_scale(const char *opt, const char *arg)
      ^
3093. {
3094.     unsigned int stream;

ffmpeg.c:3098:5: 
3096.     char *p;
3097. 
3098.     stream = strtol(arg, &p, 0);
          ^
3099.     if (*p)
3100.         p++;

ffmpeg.c:3099:9: Taking false branch
3097. 
3098.     stream = strtol(arg, &p, 0);
3099.     if (*p)
              ^
3100.         p++;
3101.     scale= strtod(p, &p);

ffmpeg.c:3101:5: 
3099.     if (*p)
3100.         p++;
3101.     scale= strtod(p, &p);
          ^
3102. 
3103.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);

ffmpeg.c:3103:5: 
3101.     scale= strtod(p, &p);
3102. 
3103.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
          ^
3104.     ts_scale[stream] = scale;
3105.     return 0;

ffmpeg.c:534:1: start of procedure grow_array()
  532. 
  533. /* similar to ff_dynarray_add() and av_fast_realloc() */
  534. static void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  535. {
  536.     if (new_size >= INT_MAX / elem_size) {

ffmpeg.c:536:9: Taking true branch
  534. static void *grow_array(void *array, int elem_size, int *size, int new_size)
  535. {
  536.     if (new_size >= INT_MAX / elem_size) {
               ^
  537.         fprintf(stderr, "Array too big.\n");
  538.         ffmpeg_exit(1);

ffmpeg.c:537:9: 
  535. {
  536.     if (new_size >= INT_MAX / elem_size) {
  537.         fprintf(stderr, "Array too big.\n");
               ^
  538.         ffmpeg_exit(1);
  539.     }

ffmpeg.c:538:9: Skipping ffmpeg_exit(): empty list of specs
  536.     if (new_size >= INT_MAX / elem_size) {
  537.         fprintf(stderr, "Array too big.\n");
  538.         ffmpeg_exit(1);
               ^
  539.     }
  540.     if (*size < new_size) {

ffmpeg.c:540:9: Taking true branch
  538.         ffmpeg_exit(1);
  539.     }
  540.     if (*size < new_size) {
               ^
  541.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  542.         if (!tmp) {

ffmpeg.c:541:9: 
  539.     }
  540.     if (*size < new_size) {
  541.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
               ^
  542.         if (!tmp) {
  543.             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:542:14: Taking true branch
  540.     if (*size < new_size) {
  541.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  542.         if (!tmp) {
                    ^
  543.             fprintf(stderr, "Could not alloc buffer.\n");
  544.             ffmpeg_exit(1);

ffmpeg.c:543:13: 
  541.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  542.         if (!tmp) {
  543.             fprintf(stderr, "Could not alloc buffer.\n");
                   ^
  544.             ffmpeg_exit(1);
  545.         }

ffmpeg.c:544:13: Skipping ffmpeg_exit(): empty list of specs
  542.         if (!tmp) {
  543.             fprintf(stderr, "Could not alloc buffer.\n");
  544.             ffmpeg_exit(1);
                   ^
  545.         }
  546.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

ffmpeg.c:546:9: 
  544.             ffmpeg_exit(1);
  545.         }
  546.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
               ^
  547.         *size = new_size;
  548.         return tmp;

ffmpeg.c:547:9: 
  545.         }
  546.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  547.         *size = new_size;
               ^
  548.         return tmp;
  549.     }

ffmpeg.c:548:9: 
  546.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  547.         *size = new_size;
  548.         return tmp;
               ^
  549.     }
  550.     return array;

ffmpeg.c:551:1: return from a call to grow_array
  549.     }
  550.     return array;
  551. }
       ^
  552. 
  553. static void choose_sample_fmt(AVStream *st, AVCodec *codec)

ffmpeg.c:3104:5: 
3102. 
3103.     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
3104.     ts_scale[stream] = scale;
          ^
3105.     return 0;
3106. }

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