libavformat/movenc.c:1142: error: Null Dereference
  pointer `ctts_entries` last assigned on line 1141 could be null and is dereferenced at line 1142, column 5.

libavformat/movenc.c:1134:1: start of procedure mov_write_ctts_tag()
1132. }
1133. 
1134. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
      ^
1135. {
1136.     MOVStts *ctts_entries;

libavformat/movenc.c:1137:5: 
1135. {
1136.     MOVStts *ctts_entries;
1137.     uint32_t entries = 0;
          ^
1138.     uint32_t atom_size;
1139.     int i;

libavformat/movenc.c:1141:5: 
1139.     int i;
1140. 
1141.     ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */
          ^
1142.     ctts_entries[0].count = 1;
1143.     ctts_entries[0].duration = track->cluster[0].cts;

libavutil/mem.c:62:1: start of procedure av_malloc()
  60.  * linker will do it automatically. */
  61. 
  62. void *av_malloc(size_t size)
      ^
  63. {
  64.     void *ptr = NULL;

libavutil/mem.c:64:5: 
  62. void *av_malloc(size_t size)
  63. {
  64.     void *ptr = NULL;
          ^
  65. #if CONFIG_MEMALIGN_HACK
  66.     long diff;

libavutil/mem.c:70:9: Taking true branch
  68. 
  69.     /* let's disallow possibly ambiguous cases */
  70.     if (size > (INT_MAX - 32) || !size)
              ^
  71.         return NULL;
  72. 

libavutil/mem.c:71:9: 
  69.     /* let's disallow possibly ambiguous cases */
  70.     if (size > (INT_MAX - 32) || !size)
  71.         return NULL;
              ^
  72. 
  73. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:115:1: return from a call to av_malloc
  113. #endif
  114.     return ptr;
  115. }
       ^
  116. 
  117. void *av_realloc(void *ptr, size_t size)

libavformat/movenc.c:1142:5: 
1140. 
1141.     ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */
1142.     ctts_entries[0].count = 1;
          ^
1143.     ctts_entries[0].duration = track->cluster[0].cts;
1144.     for (i = 1; i < track->entry; i++) {

static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
{
    MOVStts *ctts_entries;
    uint32_t entries = 0;
    uint32_t atom_size;
    int i;
    ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries));
    ctts_entries[0].count = 1;
    ctts_entries[0].duration = track->cluster[0].cts;
    for (i = 1; i < track->entry; i++) {
        if (track->cluster[i].cts == ctts_entries[entries].duration) {
            ctts_entries[entries].count++;
        } else {
            entries++;
            ctts_entries[entries].duration = track->cluster[i].cts;
            ctts_entries[entries].count = 1;
        }
    }
    entries++;
    atom_size = 16 + (entries * 8);
    avio_wb32(pb, atom_size);
    ffio_wfourcc(pb, "ctts");
    avio_wb32(pb, 0);
    avio_wb32(pb, entries);
    for (i = 0; i < entries; i++) {
        avio_wb32(pb, ctts_entries[i].count);
        avio_wb32(pb, ctts_entries[i].duration);
    }
    av_free(ctts_entries);
    return atom_size;
}
['static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)\n{\n    MOVStts *ctts_entries;\n    uint32_t entries = 0;\n    uint32_t atom_size;\n    int i;\n    ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries));\n    ctts_entries[0].count = 1;\n    ctts_entries[0].duration = track->cluster[0].cts;\n    for (i = 1; i < track->entry; i++) {\n        if (track->cluster[i].cts == ctts_entries[entries].duration) {\n            ctts_entries[entries].count++;\n        } else {\n            entries++;\n            ctts_entries[entries].duration = track->cluster[i].cts;\n            ctts_entries[entries].count = 1;\n        }\n    }\n    entries++;\n    atom_size = 16 + (entries * 8);\n    avio_wb32(pb, atom_size);\n    ffio_wfourcc(pb, "ctts");\n    avio_wb32(pb, 0);\n    avio_wb32(pb, entries);\n    for (i = 0; i < entries; i++) {\n        avio_wb32(pb, ctts_entries[i].count);\n        avio_wb32(pb, ctts_entries[i].duration);\n    }\n    av_free(ctts_entries);\n    return atom_size;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if (size > (INT_MAX - 32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size + 32);\n    if (!ptr)\n        return ptr;\n    diff              = ((-(long)ptr - 1) & 31) + 1;\n    ptr               = (char *)ptr + diff;\n    ((char *)ptr)[-1] = diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr, 32, size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32, size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']