libavformat/matroskadec.c:851: error: Memory Leak
  memory dynamically allocated by call to `av_realloc()` at line 851, column 24 is not reachable after line 851, column 13.

libavformat/matroskadec.c:817:1: start of procedure matroska_decode_buffer()
815. }
816. 
817. static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
     ^
818.                                   MatroskaTrack *track)
819. {

libavformat/matroskadec.c:820:5: 
818.                                   MatroskaTrack *track)
819. {
820.     MatroskaTrackEncoding *encodings = track->encodings.elem;
         ^
821.     uint8_t* data = *buf;
822.     int isize = *buf_size;

libavformat/matroskadec.c:821:5: 
819. {
820.     MatroskaTrackEncoding *encodings = track->encodings.elem;
821.     uint8_t* data = *buf;
         ^
822.     int isize = *buf_size;
823.     uint8_t* pkt_data = NULL;

libavformat/matroskadec.c:822:5: 
820.     MatroskaTrackEncoding *encodings = track->encodings.elem;
821.     uint8_t* data = *buf;
822.     int isize = *buf_size;
         ^
823.     uint8_t* pkt_data = NULL;
824.     int pkt_size = isize;

libavformat/matroskadec.c:823:5: 
821.     uint8_t* data = *buf;
822.     int isize = *buf_size;
823.     uint8_t* pkt_data = NULL;
         ^
824.     int pkt_size = isize;
825.     int result = 0;

libavformat/matroskadec.c:824:5: 
822.     int isize = *buf_size;
823.     uint8_t* pkt_data = NULL;
824.     int pkt_size = isize;
         ^
825.     int result = 0;
826.     int olen;

libavformat/matroskadec.c:825:5: 
823.     uint8_t* pkt_data = NULL;
824.     int pkt_size = isize;
825.     int result = 0;
         ^
826.     int olen;
827. 

libavformat/matroskadec.c:828:5: 
826.     int olen;
827. 
828.     switch (encodings[0].compression.algo) {
         ^
829.     case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
830.         return encodings[0].compression.settings.size;

libavformat/matroskadec.c:829:5: Switch condition is false. Skipping switch case
827. 
828.     switch (encodings[0].compression.algo) {
829.     case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
         ^
830.         return encodings[0].compression.settings.size;
831.     case MATROSKA_TRACK_ENCODING_COMP_LZO:

libavformat/matroskadec.c:831:5: Switch condition is false. Skipping switch case
829.     case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
830.         return encodings[0].compression.settings.size;
831.     case MATROSKA_TRACK_ENCODING_COMP_LZO:
         ^
832.         do {
833.             olen = pkt_size *= 3;

libavformat/matroskadec.c:843:5: Switch condition is true. Entering switch case
841.         break;
842. #ifdef CONFIG_ZLIB
843.     case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
         ^
844.         z_stream zstream = {0};
845.         if (inflateInit(&zstream) != Z_OK)

libavformat/matroskadec.c:844:9: 
842. #ifdef CONFIG_ZLIB
843.     case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
844.         z_stream zstream = {0};
             ^
845.         if (inflateInit(&zstream) != Z_OK)
846.             return -1;

libavformat/matroskadec.c:845:13: Taking false branch
843.     case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
844.         z_stream zstream = {0};
845.         if (inflateInit(&zstream) != Z_OK)
                 ^
846.             return -1;
847.         zstream.next_in = data;

libavformat/matroskadec.c:847:9: 
845.         if (inflateInit(&zstream) != Z_OK)
846.             return -1;
847.         zstream.next_in = data;
             ^
848.         zstream.avail_in = isize;
849.         do {

libavformat/matroskadec.c:848:9: 
846.             return -1;
847.         zstream.next_in = data;
848.         zstream.avail_in = isize;
             ^
849.         do {
850.             pkt_size *= 3;

libavformat/matroskadec.c:850:13: 
848.         zstream.avail_in = isize;
849.         do {
850.             pkt_size *= 3;
                 ^
851.             pkt_data = av_realloc(pkt_data, pkt_size);
852.             zstream.avail_out = pkt_size - zstream.total_out;

libavformat/matroskadec.c:851:13: 
849.         do {
850.             pkt_size *= 3;
851.             pkt_data = av_realloc(pkt_data, pkt_size);
                 ^
852.             zstream.avail_out = pkt_size - zstream.total_out;
853.             zstream.next_out = pkt_data + zstream.total_out;

libavutil/mem.c:94:1: start of procedure av_realloc()
  92. }
  93. 
  94. void *av_realloc(void *ptr, unsigned int size)
      ^
  95. {
  96. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:101:8: Taking false branch
   99. 
  100.     /* let's disallow possible ambiguous cases */
  101.     if(size > (INT_MAX-16) )
              ^
  102.         return NULL;
  103. 

libavutil/mem.c:110:5: 
  108.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
  109. #else
  110.     return realloc(ptr, size);
           ^
  111. #endif
  112. }

libavutil/mem.c:112:1: return from a call to av_realloc
  110.     return realloc(ptr, size);
  111. #endif
  112. }
       ^
  113. 
  114. void av_free(void *ptr)

libavformat/matroskadec.c:852:13: 
850.             pkt_size *= 3;
851.             pkt_data = av_realloc(pkt_data, pkt_size);
852.             zstream.avail_out = pkt_size - zstream.total_out;
                 ^
853.             zstream.next_out = pkt_data + zstream.total_out;
854.             result = inflate(&zstream, Z_NO_FLUSH);

libavformat/matroskadec.c:853:13: 
851.             pkt_data = av_realloc(pkt_data, pkt_size);
852.             zstream.avail_out = pkt_size - zstream.total_out;
853.             zstream.next_out = pkt_data + zstream.total_out;
                 ^
854.             result = inflate(&zstream, Z_NO_FLUSH);
855.         } while (result==Z_OK && pkt_size<10000000);

libavformat/matroskadec.c:854:13: Skipping inflate(): method has no implementation
852.             zstream.avail_out = pkt_size - zstream.total_out;
853.             zstream.next_out = pkt_data + zstream.total_out;
854.             result = inflate(&zstream, Z_NO_FLUSH);
                 ^
855.         } while (result==Z_OK && pkt_size<10000000);
856.         pkt_size = zstream.total_out;

libavformat/matroskadec.c:855:18: Loop condition is true. Entering loop body
853.             zstream.next_out = pkt_data + zstream.total_out;
854.             result = inflate(&zstream, Z_NO_FLUSH);
855.         } while (result==Z_OK && pkt_size<10000000);
                      ^
856.         pkt_size = zstream.total_out;
857.         inflateEnd(&zstream);

libavformat/matroskadec.c:855:34: Loop condition is true. Entering loop body
853.             zstream.next_out = pkt_data + zstream.total_out;
854.             result = inflate(&zstream, Z_NO_FLUSH);
855.         } while (result==Z_OK && pkt_size<10000000);
                                      ^
856.         pkt_size = zstream.total_out;
857.         inflateEnd(&zstream);

libavformat/matroskadec.c:850:13: 
848.         zstream.avail_in = isize;
849.         do {
850.             pkt_size *= 3;
                 ^
851.             pkt_data = av_realloc(pkt_data, pkt_size);
852.             zstream.avail_out = pkt_size - zstream.total_out;

libavformat/matroskadec.c:851:13: 
849.         do {
850.             pkt_size *= 3;
851.             pkt_data = av_realloc(pkt_data, pkt_size);
                 ^
852.             zstream.avail_out = pkt_size - zstream.total_out;
853.             zstream.next_out = pkt_data + zstream.total_out;

libavutil/mem.c:94:1: start of procedure av_realloc()
  92. }
  93. 
  94. void *av_realloc(void *ptr, unsigned int size)
      ^
  95. {
  96. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:101:8: Taking true branch
   99. 
  100.     /* let's disallow possible ambiguous cases */
  101.     if(size > (INT_MAX-16) )
              ^
  102.         return NULL;
  103. 

libavutil/mem.c:102:9: 
  100.     /* let's disallow possible ambiguous cases */
  101.     if(size > (INT_MAX-16) )
  102.         return NULL;
               ^
  103. 
  104. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:112:1: return from a call to av_realloc
  110.     return realloc(ptr, size);
  111. #endif
  112. }
       ^
  113. 
  114. void av_free(void *ptr)
