libavcodec/h264_mp4toannexb_bsf.c:91: error: Memory Leak
  memory dynamically allocated by call to `av_realloc()` at line 91, column 19 is not reachable after line 91, column 13.

libavcodec/h264_mp4toannexb_bsf.c:49:1: start of procedure h264_mp4toannexb_filter()
47. }
48. 
49. static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
    ^
50.                                    AVCodecContext *avctx, const char *args,
51.                                    uint8_t  **poutbuf, int *poutbuf_size,

libavcodec/h264_mp4toannexb_bsf.c:54:5: 
52.                                    const uint8_t *buf, int      buf_size,
53.                                    int keyframe) {
54.     H264BSFContext *ctx = bsfc->priv_data;
        ^
55.     uint8_t unit_type;
56.     uint32_t nal_size, cumul_size = 0;

libavcodec/h264_mp4toannexb_bsf.c:56:5: 
54.     H264BSFContext *ctx = bsfc->priv_data;
55.     uint8_t unit_type;
56.     uint32_t nal_size, cumul_size = 0;
        ^
57. 
58.     /* nothing to filter */

libavcodec/h264_mp4toannexb_bsf.c:59:10: Taking false branch
57. 
58.     /* nothing to filter */
59.     if (!avctx->extradata || avctx->extradata_size < 6) {
             ^
60.         *poutbuf = (uint8_t*) buf;
61.         *poutbuf_size = buf_size;

libavcodec/h264_mp4toannexb_bsf.c:59:30: Taking false branch
57. 
58.     /* nothing to filter */
59.     if (!avctx->extradata || avctx->extradata_size < 6) {
                                 ^
60.         *poutbuf = (uint8_t*) buf;
61.         *poutbuf_size = buf_size;

libavcodec/h264_mp4toannexb_bsf.c:66:10: Taking true branch
64. 
65.     /* retrieve sps and pps NAL units from extradata */
66.     if (!ctx->sps_pps_data) {
             ^
67.         uint16_t unit_size;
68.         uint32_t total_size = 0;

libavcodec/h264_mp4toannexb_bsf.c:68:9: 
66.     if (!ctx->sps_pps_data) {
67.         uint16_t unit_size;
68.         uint32_t total_size = 0;
            ^
69.         uint8_t *out = NULL, unit_nb, sps_done = 0;
70.         const uint8_t *extradata = avctx->extradata+4;

libavcodec/h264_mp4toannexb_bsf.c:69:9: 
67.         uint16_t unit_size;
68.         uint32_t total_size = 0;
69.         uint8_t *out = NULL, unit_nb, sps_done = 0;
            ^
70.         const uint8_t *extradata = avctx->extradata+4;
71.         static const uint8_t nalu_header[4] = {0, 0, 0, 1};

libavcodec/h264_mp4toannexb_bsf.c:70:9: 
68.         uint32_t total_size = 0;
69.         uint8_t *out = NULL, unit_nb, sps_done = 0;
70.         const uint8_t *extradata = avctx->extradata+4;
            ^
71.         static const uint8_t nalu_header[4] = {0, 0, 0, 1};
72. 

libavcodec/h264_mp4toannexb_bsf.c:71:9: 
69.         uint8_t *out = NULL, unit_nb, sps_done = 0;
70.         const uint8_t *extradata = avctx->extradata+4;
71.         static const uint8_t nalu_header[4] = {0, 0, 0, 1};
            ^
72. 
73.         /* retrieve length coded size */

libavcodec/h264_mp4toannexb_bsf.c:74:9: 
72. 
73.         /* retrieve length coded size */
74.         ctx->length_size = (*extradata++ & 0x3) + 1;
            ^
75.         if (ctx->length_size == 3)
76.             return AVERROR(EINVAL);

libavcodec/h264_mp4toannexb_bsf.c:75:13: Taking false branch
73.         /* retrieve length coded size */
74.         ctx->length_size = (*extradata++ & 0x3) + 1;
75.         if (ctx->length_size == 3)
                ^
76.             return AVERROR(EINVAL);
77. 

libavcodec/h264_mp4toannexb_bsf.c:79:9: 
77. 
78.         /* retrieve sps and pps unit(s) */
79.         unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
            ^
80.         if (!unit_nb) {
81.             unit_nb = *extradata++; /* number of pps unit(s) */

libavcodec/h264_mp4toannexb_bsf.c:80:14: Taking false branch
78.         /* retrieve sps and pps unit(s) */
79.         unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
80.         if (!unit_nb) {
                 ^
81.             unit_nb = *extradata++; /* number of pps unit(s) */
82.             sps_done++;

libavcodec/h264_mp4toannexb_bsf.c:84:16: Loop condition is true. Entering loop body
82.             sps_done++;
83.         }
84.         while (unit_nb--) {
                   ^
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;

libavcodec/h264_mp4toannexb_bsf.c:85:13: 
83.         }
84.         while (unit_nb--) {
85.             unit_size = AV_RB16(extradata);
                ^
86.             total_size += unit_size+4;
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {

libavcodec/h264_mp4toannexb_bsf.c:86:13: 
84.         while (unit_nb--) {
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;
                ^
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
88.                 av_free(out);

libavcodec/h264_mp4toannexb_bsf.c:87:17: Taking false branch
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
                    ^
88.                 av_free(out);
89.                 return AVERROR(EINVAL);

libavcodec/h264_mp4toannexb_bsf.c:91:13: 
89.                 return AVERROR(EINVAL);
90.             }
91.             out = av_realloc(out, total_size);
                ^
92.             if (!out)
93.                 return AVERROR(ENOMEM);

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)

libavcodec/h264_mp4toannexb_bsf.c:92:18: Taking false branch
90.             }
91.             out = av_realloc(out, total_size);
92.             if (!out)
                     ^
93.                 return AVERROR(ENOMEM);
94.             memcpy(out+total_size-unit_size-4, nalu_header, 4);

libavcodec/h264_mp4toannexb_bsf.c:94:13: 
92.             if (!out)
93.                 return AVERROR(ENOMEM);
94.             memcpy(out+total_size-unit_size-4, nalu_header, 4);
                ^
95.             memcpy(out+total_size-unit_size,   extradata+2, unit_size);
96.             extradata += 2+unit_size;

libavcodec/h264_mp4toannexb_bsf.c:95:13: 
93.                 return AVERROR(ENOMEM);
94.             memcpy(out+total_size-unit_size-4, nalu_header, 4);
95.             memcpy(out+total_size-unit_size,   extradata+2, unit_size);
                ^
96.             extradata += 2+unit_size;
97. 

libavcodec/h264_mp4toannexb_bsf.c:96:13: 
94.             memcpy(out+total_size-unit_size-4, nalu_header, 4);
95.             memcpy(out+total_size-unit_size,   extradata+2, unit_size);
96.             extradata += 2+unit_size;
                ^
97. 
98.             if (!unit_nb && !sps_done++)

libavcodec/h264_mp4toannexb_bsf.c:98:18: Taking false branch
 96.             extradata += 2+unit_size;
 97. 
 98.             if (!unit_nb && !sps_done++)
                      ^
 99.                 unit_nb = *extradata++; /* number of pps unit(s) */
100.         }

libavcodec/h264_mp4toannexb_bsf.c:84:16: Loop condition is true. Entering loop body
82.             sps_done++;
83.         }
84.         while (unit_nb--) {
                   ^
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;

libavcodec/h264_mp4toannexb_bsf.c:85:13: 
83.         }
84.         while (unit_nb--) {
85.             unit_size = AV_RB16(extradata);
                ^
86.             total_size += unit_size+4;
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {

libavcodec/h264_mp4toannexb_bsf.c:86:13: 
84.         while (unit_nb--) {
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;
                ^
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
88.                 av_free(out);

libavcodec/h264_mp4toannexb_bsf.c:87:17: Taking false branch
85.             unit_size = AV_RB16(extradata);
86.             total_size += unit_size+4;
87.             if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
                    ^
88.                 av_free(out);
89.                 return AVERROR(EINVAL);

libavcodec/h264_mp4toannexb_bsf.c:91:13: 
89.                 return AVERROR(EINVAL);
90.             }
91.             out = av_realloc(out, total_size);
                ^
92.             if (!out)
93.                 return AVERROR(ENOMEM);

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)
