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

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

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

libavcodec/h264_mp4toannexb_bsf.c:58:5: 
56.     uint8_t unit_type;
57.     int32_t nal_size;
58.     uint32_t cumul_size = 0;
        ^
59.     const uint8_t *buf_end = buf + buf_size;
60. 

libavcodec/h264_mp4toannexb_bsf.c:59:5: 
57.     int32_t nal_size;
58.     uint32_t cumul_size = 0;
59.     const uint8_t *buf_end = buf + buf_size;
        ^
60. 
61.     /* nothing to filter */

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

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

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

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

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

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

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

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

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

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

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

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

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

libavutil/bswap.h:52:1: start of procedure bswap_16()
  50. 
  51. #ifndef bswap_16
  52. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
      ^
  53. {
  54.     x= (x>>8) | (x<<8);

libavutil/bswap.h:54:5: 
  52. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
  53. {
  54.     x= (x>>8) | (x<<8);
          ^
  55.     return x;
  56. }

libavutil/bswap.h:55:5: 
  53. {
  54.     x= (x>>8) | (x<<8);
  55.     return x;
          ^
  56. }
  57. #endif

libavutil/bswap.h:56:1: return from a call to bswap_16
  54.     x= (x>>8) | (x<<8);
  55.     return x;
  56. }
      ^
  57. #endif
  58. 

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

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

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

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

libavutil/mem.c:119:1: start of procedure av_realloc()
  117. }
  118. 
  119. void *av_realloc(void *ptr, unsigned int size)
       ^
  120. {
  121. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:126:8: Taking false branch
  124. 
  125.     /* let's disallow possible ambiguous cases */
  126.     if(size > (INT_MAX-16) )
              ^
  127.         return NULL;
  128. 

libavutil/mem.c:135:5: 
  133.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
  134. #else
  135.     return realloc(ptr, size);
           ^
  136. #endif
  137. }

libavutil/mem.c:137:1: return from a call to av_realloc
  135.     return realloc(ptr, size);
  136. #endif
  137. }
       ^
  138. 
  139. void av_free(void *ptr)

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

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

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

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

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

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

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

libavutil/bswap.h:52:1: start of procedure bswap_16()
  50. 
  51. #ifndef bswap_16
  52. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
      ^
  53. {
  54.     x= (x>>8) | (x<<8);

libavutil/bswap.h:54:5: 
  52. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
  53. {
  54.     x= (x>>8) | (x<<8);
          ^
  55.     return x;
  56. }

libavutil/bswap.h:55:5: 
  53. {
  54.     x= (x>>8) | (x<<8);
  55.     return x;
          ^
  56. }
  57. #endif

libavutil/bswap.h:56:1: return from a call to bswap_16
  54.     x= (x>>8) | (x<<8);
  55.     return x;
  56. }
      ^
  57. #endif
  58. 

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

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

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

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

libavutil/mem.c:119:1: start of procedure av_realloc()
  117. }
  118. 
  119. void *av_realloc(void *ptr, unsigned int size)
       ^
  120. {
  121. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:126:8: Taking true branch
  124. 
  125.     /* let's disallow possible ambiguous cases */
  126.     if(size > (INT_MAX-16) )
              ^
  127.         return NULL;
  128. 

libavutil/mem.c:127:9: 
  125.     /* let's disallow possible ambiguous cases */
  126.     if(size > (INT_MAX-16) )
  127.         return NULL;
               ^
  128. 
  129. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:137:1: return from a call to av_realloc
  135.     return realloc(ptr, size);
  136. #endif
  137. }
       ^
  138. 
  139. void av_free(void *ptr)
