libavformat/matroskaenc.c:630: error: Null Dereference
  pointer `mkv->md5_ctx` last assigned on line 629 could be null and is dereferenced by call to `av_md5_init()` at line 630, column 5.

libavformat/matroskaenc.c:622:1: start of procedure mkv_write_header()
620. }
621. 
622. static int mkv_write_header(AVFormatContext *s)
     ^
623. {
624.     MatroskaMuxContext *mkv = s->priv_data;

libavformat/matroskaenc.c:624:5: 
622. static int mkv_write_header(AVFormatContext *s)
623. {
624.     MatroskaMuxContext *mkv = s->priv_data;
         ^
625.     ByteIOContext *pb = s->pb;
626.     ebml_master ebml_header, segment_info;

libavformat/matroskaenc.c:625:5: 
623. {
624.     MatroskaMuxContext *mkv = s->priv_data;
625.     ByteIOContext *pb = s->pb;
         ^
626.     ebml_master ebml_header, segment_info;
627.     int ret;

libavformat/matroskaenc.c:629:5: 
627.     int ret;
628. 
629.     mkv->md5_ctx = av_mallocz(av_md5_size);
         ^
630.     av_md5_init(mkv->md5_ctx);
631. 

libavutil/mem.c:132:1: start of procedure av_mallocz()
  130. }
  131. 
  132. void *av_mallocz(unsigned int size)
       ^
  133. {
  134.     void *ptr = av_malloc(size);

libavutil/mem.c:134:5: 
  132. void *av_mallocz(unsigned int size)
  133. {
  134.     void *ptr = av_malloc(size);
           ^
  135.     if (ptr)
  136.         memset(ptr, 0, size);

libavutil/mem.c:42:1: start of procedure av_malloc()
    40.    linker will do it automatically */
    41. 
    42. void *av_malloc(unsigned int size)
        ^
    43. {
    44.     void *ptr;

libavutil/mem.c:50:8: Taking true branch
    48. 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
               ^
    51.         return NULL;
    52. 

libavutil/mem.c:51:9: 
    49.     /* let's disallow possible ambiguous cases */
    50.     if(size > (INT_MAX-16) )
    51.         return NULL;
                ^
    52. 
    53. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:92:1: return from a call to av_malloc
    90. #endif
    91.     return ptr;
    92. }
        ^
    93. 
    94. void *av_realloc(void *ptr, unsigned int size)

libavutil/mem.c:135:9: Taking false branch
  133. {
  134.     void *ptr = av_malloc(size);
  135.     if (ptr)
               ^
  136.         memset(ptr, 0, size);
  137.     return ptr;

libavutil/mem.c:137:5: 
  135.     if (ptr)
  136.         memset(ptr, 0, size);
  137.     return ptr;
           ^
  138. }
  139. 

libavutil/mem.c:138:1: return from a call to av_mallocz
  136.         memset(ptr, 0, size);
  137.     return ptr;
  138. }
       ^
  139. 
  140. char *av_strdup(const char *s)

libavformat/matroskaenc.c:630:5: 
628. 
629.     mkv->md5_ctx = av_mallocz(av_md5_size);
630.     av_md5_init(mkv->md5_ctx);
         ^
631. 
632.     ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);

libavutil/md5.c:118:1: start of procedure av_md5_init()
  116. }
  117. 
  118. void av_md5_init(AVMD5 *ctx){
       ^
  119.     ctx->len    = 0;
  120. 

libavutil/md5.c:119:5: 
  117. 
  118. void av_md5_init(AVMD5 *ctx){
  119.     ctx->len    = 0;
           ^
  120. 
  121.     ctx->ABCD[0] = 0x10325476;

static int mkv_write_header(AVFormatContext *s)
{
    MatroskaMuxContext *mkv = s->priv_data;
    ByteIOContext *pb = s->pb;
    ebml_master ebml_header, segment_info;
    int ret;
    mkv->md5_ctx = av_mallocz(av_md5_size);
    av_md5_init(mkv->md5_ctx);
    ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);
    put_ebml_uint   (pb, EBML_ID_EBMLVERSION        ,           1);
    put_ebml_uint   (pb, EBML_ID_EBMLREADVERSION    ,           1);
    put_ebml_uint   (pb, EBML_ID_EBMLMAXIDLENGTH    ,           4);
    put_ebml_uint   (pb, EBML_ID_EBMLMAXSIZELENGTH  ,           8);
    put_ebml_string (pb, EBML_ID_DOCTYPE            ,  "matroska");
    put_ebml_uint   (pb, EBML_ID_DOCTYPEVERSION     ,           2);
    put_ebml_uint   (pb, EBML_ID_DOCTYPEREADVERSION ,           2);
    end_ebml_master(pb, ebml_header);
    mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
    mkv->segment_offset = url_ftell(pb);
    mkv->main_seekhead    = mkv_start_seekhead(pb, mkv->segment_offset, 10);
    mkv->cluster_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 0);
    if (mkv->main_seekhead == NULL || mkv->cluster_seekhead == NULL)
        return AVERROR(ENOMEM);
    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
    if (ret < 0) return ret;
    segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);
    put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000);
    if (strlen(s->title))
        put_ebml_string(pb, MATROSKA_ID_TITLE, s->title);
    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
        put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);
        put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
        mkv->segment_uid = url_ftell(pb);
        put_ebml_void(pb, 19);
    }
    mkv->duration = 0;
    mkv->duration_offset = url_ftell(pb);
    put_ebml_void(pb, 11);
    end_ebml_master(pb, segment_info);
    ret = mkv_write_tracks(s);
    if (ret < 0) return ret;
    ret = mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb));
    if (ret < 0) return ret;
    mkv->cluster_pos = url_ftell(pb);
    mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
    put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, 0);
    mkv->cluster_pts = 0;
    mkv->cues = mkv_start_cues(mkv->segment_offset);
    if (mkv->cues == NULL)
        return AVERROR(ENOMEM);
    return 0;
}
['static int mkv_write_header(AVFormatContext *s)\n{\n    MatroskaMuxContext *mkv = s->priv_data;\n    ByteIOContext *pb = s->pb;\n    ebml_master ebml_header, segment_info;\n    int ret;\n    mkv->md5_ctx = av_mallocz(av_md5_size);\n    av_md5_init(mkv->md5_ctx);\n    ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);\n    put_ebml_uint   (pb, EBML_ID_EBMLVERSION        ,           1);\n    put_ebml_uint   (pb, EBML_ID_EBMLREADVERSION    ,           1);\n    put_ebml_uint   (pb, EBML_ID_EBMLMAXIDLENGTH    ,           4);\n    put_ebml_uint   (pb, EBML_ID_EBMLMAXSIZELENGTH  ,           8);\n    put_ebml_string (pb, EBML_ID_DOCTYPE            ,  "matroska");\n    put_ebml_uint   (pb, EBML_ID_DOCTYPEVERSION     ,           2);\n    put_ebml_uint   (pb, EBML_ID_DOCTYPEREADVERSION ,           2);\n    end_ebml_master(pb, ebml_header);\n    mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);\n    mkv->segment_offset = url_ftell(pb);\n    mkv->main_seekhead    = mkv_start_seekhead(pb, mkv->segment_offset, 10);\n    mkv->cluster_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 0);\n    if (mkv->main_seekhead == NULL || mkv->cluster_seekhead == NULL)\n        return AVERROR(ENOMEM);\n    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));\n    if (ret < 0) return ret;\n    segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);\n    put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000);\n    if (strlen(s->title))\n        put_ebml_string(pb, MATROSKA_ID_TITLE, s->title);\n    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {\n        put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);\n        put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);\n        mkv->segment_uid = url_ftell(pb);\n        put_ebml_void(pb, 19);\n    }\n    mkv->duration = 0;\n    mkv->duration_offset = url_ftell(pb);\n    put_ebml_void(pb, 11);\n    end_ebml_master(pb, segment_info);\n    ret = mkv_write_tracks(s);\n    if (ret < 0) return ret;\n    ret = mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb));\n    if (ret < 0) return ret;\n    mkv->cluster_pos = url_ftell(pb);\n    mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);\n    put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, 0);\n    mkv->cluster_pts = 0;\n    mkv->cues = mkv_start_cues(mkv->segment_offset);\n    if (mkv->cues == NULL)\n        return AVERROR(ENOMEM);\n    return 0;\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'void av_md5_init(AVMD5 *ctx){\n    ctx->len    = 0;\n    ctx->ABCD[0] = 0x10325476;\n    ctx->ABCD[1] = 0x98badcfe;\n    ctx->ABCD[2] = 0xefcdab89;\n    ctx->ABCD[3] = 0x67452301;\n}']