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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

libavutil/bswap.h:44:1: start of procedure bswap_16()
  42. 
  43. #ifndef bswap_16
  44. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
      ^
  45. {
  46.     x= (x>>8) | (x<<8);

libavutil/bswap.h:46:5: 
  44. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
  45. {
  46.     x= (x>>8) | (x<<8);
          ^
  47.     return x;
  48. }

libavutil/bswap.h:47:5: 
  45. {
  46.     x= (x>>8) | (x<<8);
  47.     return x;
          ^
  48. }
  49. #endif

libavutil/bswap.h:48:1: return from a call to bswap_16
  46.     x= (x>>8) | (x<<8);
  47.     return x;
  48. }
      ^
  49. #endif
  50. 

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

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

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

libavutil/mem.c:102:1: start of procedure av_realloc()
  100. }
  101. 
  102. void *av_realloc(void *ptr, unsigned int size)
       ^
  103. {
  104. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:109:8: Taking false branch
  107. 
  108.     /* let's disallow possible ambiguous cases */
  109.     if(size > (INT_MAX-16) )
              ^
  110.         return NULL;
  111. 

libavutil/mem.c:118:5: 
  116.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
  117. #else
  118.     return realloc(ptr, size);
           ^
  119. #endif
  120. }

libavutil/mem.c:120:1: return from a call to av_realloc
  118.     return realloc(ptr, size);
  119. #endif
  120. }
       ^
  121. 
  122. void av_free(void *ptr)

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

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

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

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

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

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

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

libavutil/bswap.h:44:1: start of procedure bswap_16()
  42. 
  43. #ifndef bswap_16
  44. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
      ^
  45. {
  46.     x= (x>>8) | (x<<8);

libavutil/bswap.h:46:5: 
  44. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
  45. {
  46.     x= (x>>8) | (x<<8);
          ^
  47.     return x;
  48. }

libavutil/bswap.h:47:5: 
  45. {
  46.     x= (x>>8) | (x<<8);
  47.     return x;
          ^
  48. }
  49. #endif

libavutil/bswap.h:48:1: return from a call to bswap_16
  46.     x= (x>>8) | (x<<8);
  47.     return x;
  48. }
      ^
  49. #endif
  50. 

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

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

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

libavutil/mem.c:102:1: start of procedure av_realloc()
  100. }
  101. 
  102. void *av_realloc(void *ptr, unsigned int size)
       ^
  103. {
  104. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:109:8: Taking true branch
  107. 
  108.     /* let's disallow possible ambiguous cases */
  109.     if(size > (INT_MAX-16) )
              ^
  110.         return NULL;
  111. 

libavutil/mem.c:110:9: 
  108.     /* let's disallow possible ambiguous cases */
  109.     if(size > (INT_MAX-16) )
  110.         return NULL;
               ^
  111. 
  112. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:120:1: return from a call to av_realloc
  118.     return realloc(ptr, size);
  119. #endif
  120. }
       ^
  121. 
  122. void av_free(void *ptr)
