libavformat/matroskaenc.c:395: error: Null Dereference
  pointer `cues->entries` last assigned on line 389 could be null and is dereferenced at line 395, column 5.

libavformat/matroskaenc.c:382:1: start of procedure mkv_add_cuepoint()
380. }
381. 
382. static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)
     ^
383. {
384.     int err;

libavformat/matroskaenc.c:386:9: Taking false branch
384.     int err;
385. 
386.     if (ts < 0)
             ^
387.         return 0;
388. 

libavformat/matroskaenc.c:389:9: 
387.         return 0;
388. 
389.     if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1,
             ^
390.                                  sizeof(*cues->entries))) < 0) {
391.         cues->num_entries = 0;

libavutil/mem.c:167:1: start of procedure av_reallocp_array()
  165. }
  166. 
  167. int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
       ^
  168. {
  169.     void **ptrptr = ptr;

libavutil/mem.c:169:5: 
  167. int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
  168. {
  169.     void **ptrptr = ptr;
           ^
  170.     void *ret;
  171.     if (!size || nmemb >= INT_MAX / size)

libavutil/mem.c:171:10: Taking false branch
  169.     void **ptrptr = ptr;
  170.     void *ret;
  171.     if (!size || nmemb >= INT_MAX / size)
                ^
  172.         return AVERROR(ENOMEM);
  173.     if (!nmemb) {

libavutil/mem.c:171:18: Taking false branch
  169.     void **ptrptr = ptr;
  170.     void *ret;
  171.     if (!size || nmemb >= INT_MAX / size)
                        ^
  172.         return AVERROR(ENOMEM);
  173.     if (!nmemb) {

libavutil/mem.c:173:10: Taking true branch
  171.     if (!size || nmemb >= INT_MAX / size)
  172.         return AVERROR(ENOMEM);
  173.     if (!nmemb) {
                ^
  174.         av_freep(ptr);
  175.         return 0;

libavutil/mem.c:174:9: 
  172.         return AVERROR(ENOMEM);
  173.     if (!nmemb) {
  174.         av_freep(ptr);
               ^
  175.         return 0;
  176.     }

libavutil/mem.c:198:1: start of procedure av_freep()
    196. }
    197. 
    198. void av_freep(void *arg)
         ^
    199. {
    200.     void **ptr = (void **)arg;

libavutil/mem.c:200:5: 
    198. void av_freep(void *arg)
    199. {
    200.     void **ptr = (void **)arg;
             ^
    201.     av_free(*ptr);
    202.     *ptr = NULL;

libavutil/mem.c:201:5: 
    199. {
    200.     void **ptr = (void **)arg;
    201.     av_free(*ptr);
             ^
    202.     *ptr = NULL;
    203. }

libavutil/mem.c:186:1: start of procedure av_free()
      184. }
      185. 
      186. void av_free(void *ptr)
           ^
      187. {
      188. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:194:5: 
      192.     _aligned_free(ptr);
      193. #else
      194.     free(ptr);
               ^
      195. #endif
      196. }

libavutil/mem.c:196:1: return from a call to av_free
      194.     free(ptr);
      195. #endif
      196. }
           ^
      197. 
      198. void av_freep(void *arg)

libavutil/mem.c:202:5: 
    200.     void **ptr = (void **)arg;
    201.     av_free(*ptr);
    202.     *ptr = NULL;
             ^
    203. }
    204. 

libavutil/mem.c:203:1: return from a call to av_freep
    201.     av_free(*ptr);
    202.     *ptr = NULL;
    203. }
         ^
    204. 
    205. void *av_mallocz(size_t size)

libavutil/mem.c:175:9: 
  173.     if (!nmemb) {
  174.         av_freep(ptr);
  175.         return 0;
               ^
  176.     }
  177.     ret = av_realloc(*ptrptr, nmemb * size);

libavutil/mem.c:184:1: return from a call to av_reallocp_array
  182.     *ptrptr = ret;
  183.     return 0;
  184. }
       ^
  185. 
  186. void av_free(void *ptr)

libavformat/matroskaenc.c:389:9: Taking false branch
387.         return 0;
388. 
389.     if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1,
             ^
390.                                  sizeof(*cues->entries))) < 0) {
391.         cues->num_entries = 0;

libavformat/matroskaenc.c:395:5: 
393.     }
394. 
395.     cues->entries[cues->num_entries].pts           = ts;
         ^
396.     cues->entries[cues->num_entries].tracknum      = stream + 1;
397.     cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;

static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)
{
    int err;
    if (ts < 0)
        return 0;
    if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1,
                                 sizeof(*cues->entries))) < 0) {
        cues->num_entries = 0;
        return err;
    }
    cues->entries[cues->num_entries].pts           = ts;
    cues->entries[cues->num_entries].tracknum      = stream + 1;
    cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
    return 0;
}
['static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)\n{\n    int err;\n    if (ts < 0)\n        return 0;\n    if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1,\n                                 sizeof(*cues->entries))) < 0) {\n        cues->num_entries = 0;\n        return err;\n    }\n    cues->entries[cues->num_entries].pts           = ts;\n    cues->entries[cues->num_entries].tracknum      = stream + 1;\n    cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;\n    return 0;\n}', 'int av_reallocp_array(void *ptr, size_t nmemb, size_t size)\n{\n    void **ptrptr = ptr;\n    void *ret;\n    if (!size || nmemb >= INT_MAX / size)\n        return AVERROR(ENOMEM);\n    if (!nmemb) {\n        av_freep(ptr);\n        return 0;\n    }\n    ret = av_realloc(*ptrptr, nmemb * size);\n    if (!ret) {\n        av_freep(ptr);\n        return AVERROR(ENOMEM);\n    }\n    *ptrptr = ret;\n    return 0;\n}', 'void av_freep(void *arg)\n{\n    void **ptr = (void **)arg;\n    av_free(*ptr);\n    *ptr = NULL;\n}', 'void av_free(void *ptr)\n{\n#if CONFIG_MEMALIGN_HACK\n    if (ptr)\n        free((char *)ptr - ((char *)ptr)[-1]);\n#elif HAVE_ALIGNED_MALLOC\n    _aligned_free(ptr);\n#else\n    free(ptr);\n#endif\n}']