libavcodec/binkaudio.c:326: error: Memory Leak
  memory dynamically allocated by call to `av_realloc()` at line 307, column 15 is not reachable after line 326, column 9.

libavcodec/binkaudio.c:289:1: start of procedure decode_frame()
287. }
288. 
289. static int decode_frame(AVCodecContext *avctx, void *data,
     ^
290.                         int *got_frame_ptr, AVPacket *avpkt)
291. {

libavcodec/binkaudio.c:292:5: 
290.                         int *got_frame_ptr, AVPacket *avpkt)
291. {
292.     BinkAudioContext *s = avctx->priv_data;
         ^
293.     GetBitContext *gb = &s->gb;
294.     int ret, consumed = 0;

libavcodec/binkaudio.c:293:5: 
291. {
292.     BinkAudioContext *s = avctx->priv_data;
293.     GetBitContext *gb = &s->gb;
         ^
294.     int ret, consumed = 0;
295. 

libavcodec/binkaudio.c:294:5: 
292.     BinkAudioContext *s = avctx->priv_data;
293.     GetBitContext *gb = &s->gb;
294.     int ret, consumed = 0;
         ^
295. 
296.     if (!get_bits_left(gb)) {

libavcodec/binkaudio.c:296:10: 
294.     int ret, consumed = 0;
295. 
296.     if (!get_bits_left(gb)) {
              ^
297.         uint8_t *buf;
298.         /* handle end-of-stream */

libavcodec/get_bits.h:505:1: start of procedure get_bits_left()
  503. }
  504. 
  505. static inline int get_bits_left(GetBitContext *gb)
       ^
  506. {
  507.     return gb->size_in_bits - get_bits_count(gb);

libavcodec/get_bits.h:507:5: 
  505. static inline int get_bits_left(GetBitContext *gb)
  506. {
  507.     return gb->size_in_bits - get_bits_count(gb);
           ^
  508. }
  509. 

libavcodec/get_bits.h:192:1: start of procedure get_bits_count()
    190. #define GET_CACHE(name, gb) ((uint32_t)name##_cache)
    191. 
    192. static inline int get_bits_count(const GetBitContext *s)
         ^
    193. {
    194.     return s->index;

libavcodec/get_bits.h:194:5: 
    192. static inline int get_bits_count(const GetBitContext *s)
    193. {
    194.     return s->index;
             ^
    195. }
    196. 

libavcodec/get_bits.h:195:1: return from a call to get_bits_count
    193. {
    194.     return s->index;
    195. }
         ^
    196. 
    197. static inline void skip_bits_long(GetBitContext *s, int n){

libavcodec/get_bits.h:508:1: return from a call to get_bits_left
  506. {
  507.     return gb->size_in_bits - get_bits_count(gb);
  508. }
       ^
  509. 
  510. //#define TRACE

libavcodec/binkaudio.c:296:10: Taking true branch
294.     int ret, consumed = 0;
295. 
296.     if (!get_bits_left(gb)) {
              ^
297.         uint8_t *buf;
298.         /* handle end-of-stream */

libavcodec/binkaudio.c:299:14: Taking false branch
297.         uint8_t *buf;
298.         /* handle end-of-stream */
299.         if (!avpkt->size) {
                  ^
300.             *got_frame_ptr = 0;
301.             return 0;

libavcodec/binkaudio.c:303:13: Taking false branch
301.             return 0;
302.         }
303.         if (avpkt->size < 4) {
                 ^
304.             av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
305.             return AVERROR_INVALIDDATA;

libavcodec/binkaudio.c:307:9: 
305.             return AVERROR_INVALIDDATA;
306.         }
307.         buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
             ^
308.         if (!buf)
309.             return AVERROR(ENOMEM);

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

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

libavutil/mem.c:138:5: 
  136.     return _aligned_realloc(ptr, size, 32);
  137. #else
  138.     return realloc(ptr, size);
           ^
  139. #endif
  140. }

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

libavcodec/binkaudio.c:308:14: Taking false branch
306.         }
307.         buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
308.         if (!buf)
                  ^
309.             return AVERROR(ENOMEM);
310.         s->packet_buffer = buf;

libavcodec/binkaudio.c:310:9: 
308.         if (!buf)
309.             return AVERROR(ENOMEM);
310.         s->packet_buffer = buf;
             ^
311.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
312.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);

libavcodec/binkaudio.c:311:9: 
309.             return AVERROR(ENOMEM);
310.         s->packet_buffer = buf;
311.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
             ^
312.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
313.         consumed = avpkt->size;

libavcodec/binkaudio.c:312:9: 
310.         s->packet_buffer = buf;
311.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
312.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
             ^
313.         consumed = avpkt->size;
314. 

libavcodec/get_bits.h:352:1: start of procedure init_get_bits()
  350.  * @param bit_size the size of the buffer in bits
  351.  */
  352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
       ^
  353.                                  int bit_size)
  354. {

libavcodec/get_bits.h:355:5: 
  353.                                  int bit_size)
  354. {
  355.     int buffer_size = (bit_size+7)>>3;
           ^
  356.     if (buffer_size < 0 || bit_size < 0) {
  357.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:356:9: Taking false branch
  354. {
  355.     int buffer_size = (bit_size+7)>>3;
  356.     if (buffer_size < 0 || bit_size < 0) {
               ^
  357.         buffer_size = bit_size = 0;
  358.         buffer = NULL;

libavcodec/get_bits.h:356:28: Taking false branch
  354. {
  355.     int buffer_size = (bit_size+7)>>3;
  356.     if (buffer_size < 0 || bit_size < 0) {
                                  ^
  357.         buffer_size = bit_size = 0;
  358.         buffer = NULL;

libavcodec/get_bits.h:361:5: 
  359.     }
  360. 
  361.     s->buffer       = buffer;
           ^
  362.     s->size_in_bits = bit_size;
  363. #if !UNCHECKED_BITSTREAM_READER

libavcodec/get_bits.h:362:5: 
  360. 
  361.     s->buffer       = buffer;
  362.     s->size_in_bits = bit_size;
           ^
  363. #if !UNCHECKED_BITSTREAM_READER
  364.     s->size_in_bits_plus8 = bit_size + 8;

libavcodec/get_bits.h:364:5: 
  362.     s->size_in_bits = bit_size;
  363. #if !UNCHECKED_BITSTREAM_READER
  364.     s->size_in_bits_plus8 = bit_size + 8;
           ^
  365. #endif
  366.     s->buffer_end   = buffer + buffer_size;

libavcodec/get_bits.h:366:5: 
  364.     s->size_in_bits_plus8 = bit_size + 8;
  365. #endif
  366.     s->buffer_end   = buffer + buffer_size;
           ^
  367.     s->index        = 0;
  368. }

libavcodec/get_bits.h:367:5: 
  365. #endif
  366.     s->buffer_end   = buffer + buffer_size;
  367.     s->index        = 0;
           ^
  368. }
  369. 

libavcodec/get_bits.h:368:1: return from a call to init_get_bits
  366.     s->buffer_end   = buffer + buffer_size;
  367.     s->index        = 0;
  368. }
       ^
  369. 
  370. static inline void align_get_bits(GetBitContext *s)

libavcodec/binkaudio.c:313:9: 
311.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
312.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
313.         consumed = avpkt->size;
             ^
314. 
315.         /* skip reported size */

libavcodec/binkaudio.c:316:9: 
314. 
315.         /* skip reported size */
316.         skip_bits_long(gb, 32);
             ^
317.     }
318. 

libavcodec/get_bits.h:197:1: start of procedure skip_bits_long()
  195. }
  196. 
  197. static inline void skip_bits_long(GetBitContext *s, int n){
       ^
  198. #if UNCHECKED_BITSTREAM_READER
  199.     s->index += n;

libavcodec/get_bits.h:199:5: 
  197. static inline void skip_bits_long(GetBitContext *s, int n){
  198. #if UNCHECKED_BITSTREAM_READER
  199.     s->index += n;
           ^
  200. #else
  201.     s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);

libavcodec/get_bits.h:203:1: return from a call to skip_bits_long
  201.     s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);
  202. #endif
  203. }
       ^
  204. 
  205. /**

libavcodec/binkaudio.c:320:5: 
318. 
319.     /* get output buffer */
320.     s->frame.nb_samples = s->frame_len;
         ^
321.     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
322.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

libavcodec/binkaudio.c:321:9: Taking false branch
319.     /* get output buffer */
320.     s->frame.nb_samples = s->frame_len;
321.     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
             ^
322.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
323.         return ret;

libavcodec/binkaudio.c:327:22: Condition is false
325. 
326.     if (decode_block(s, (float **)s->frame.extended_data,
327.                      avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {
                          ^
328.         av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
329.         return AVERROR_INVALIDDATA;

libavcodec/binkaudio.c:326:9: Skipping decode_block(): empty list of specs
324.     }
325. 
326.     if (decode_block(s, (float **)s->frame.extended_data,
             ^
327.                      avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {
328.         av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");

static int decode_frame(AVCodecContext *avctx, void *data,
                        int *got_frame_ptr, AVPacket *avpkt)
{
    BinkAudioContext *s = avctx->priv_data;
    GetBitContext *gb = &s->gb;
    int ret, consumed = 0;
    if (!get_bits_left(gb)) {
        uint8_t *buf;
        if (!avpkt->size) {
            *got_frame_ptr = 0;
            return 0;
        }
        if (avpkt->size < 4) {
            av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
            return AVERROR_INVALIDDATA;
        }
        buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
        if (!buf)
            return AVERROR(ENOMEM);
        s->packet_buffer = buf;
        memcpy(s->packet_buffer, avpkt->data, avpkt->size);
        init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
        consumed = avpkt->size;
        skip_bits_long(gb, 32);
    }
    s->frame.nb_samples = s->frame_len;
    if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return ret;
    }
    if (decode_block(s, (float **)s->frame.extended_data,
                     avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {
        av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
        return AVERROR_INVALIDDATA;
    }
    get_bits_align32(gb);
    s->frame.nb_samples = s->block_size / avctx->channels;
    *got_frame_ptr   = 1;
    *(AVFrame *)data = s->frame;
    return consumed;
}
['static int decode_frame(AVCodecContext *avctx, void *data,\n                        int *got_frame_ptr, AVPacket *avpkt)\n{\n    BinkAudioContext *s = avctx->priv_data;\n    GetBitContext *gb = &s->gb;\n    int ret, consumed = 0;\n    if (!get_bits_left(gb)) {\n        uint8_t *buf;\n        if (!avpkt->size) {\n            *got_frame_ptr = 0;\n            return 0;\n        }\n        if (avpkt->size < 4) {\n            av_log(avctx, AV_LOG_ERROR, "Packet is too small\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);\n        if (!buf)\n            return AVERROR(ENOMEM);\n        s->packet_buffer = buf;\n        memcpy(s->packet_buffer, avpkt->data, avpkt->size);\n        init_get_bits(gb, s->packet_buffer, avpkt->size * 8);\n        consumed = avpkt->size;\n        skip_bits_long(gb, 32);\n    }\n    s->frame.nb_samples = s->frame_len;\n    if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return ret;\n    }\n    if (decode_block(s, (float **)s->frame.extended_data,\n                     avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {\n        av_log(avctx, AV_LOG_ERROR, "Incomplete packet\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    get_bits_align32(gb);\n    s->frame.nb_samples = s->block_size / avctx->channels;\n    *got_frame_ptr   = 1;\n    *(AVFrame *)data = s->frame;\n    return consumed;\n}', 'static inline int get_bits_left(GetBitContext *gb)\n{\n    return gb->size_in_bits - get_bits_count(gb);\n}', 'static inline int get_bits_count(const GetBitContext *s)\n{\n    return s->index;\n}', 'void *av_realloc(void *ptr, size_t size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if (size > (INT_MAX - 16))\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if (!ptr)\n        return av_malloc(size);\n    diff = ((char *)ptr)[-1];\n    return (char *)realloc((char *)ptr - diff, size + diff) + diff;\n#elif HAVE_ALIGNED_MALLOC\n    return _aligned_realloc(ptr, size, 32);\n#else\n    return realloc(ptr, size);\n#endif\n}', 'static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,\n                                 int bit_size)\n{\n    int buffer_size = (bit_size+7)>>3;\n    if (buffer_size < 0 || bit_size < 0) {\n        buffer_size = bit_size = 0;\n        buffer = NULL;\n    }\n    s->buffer       = buffer;\n    s->size_in_bits = bit_size;\n#if !UNCHECKED_BITSTREAM_READER\n    s->size_in_bits_plus8 = bit_size + 8;\n#endif\n    s->buffer_end   = buffer + buffer_size;\n    s->index        = 0;\n}', 'static inline void skip_bits_long(GetBitContext *s, int n){\n#if UNCHECKED_BITSTREAM_READER\n    s->index += n;\n#else\n    s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);\n#endif\n}']