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

libavcodec/binkaudio.c:310:1: start of procedure decode_frame()
308. }
309. 
310. static int decode_frame(AVCodecContext *avctx, void *data,
     ^
311.                         int *got_frame_ptr, AVPacket *avpkt)
312. {

libavcodec/binkaudio.c:313:5: 
311.                         int *got_frame_ptr, AVPacket *avpkt)
312. {
313.     BinkAudioContext *s = avctx->priv_data;
         ^
314.     int16_t *samples;
315.     GetBitContext *gb = &s->gb;

libavcodec/binkaudio.c:315:5: 
313.     BinkAudioContext *s = avctx->priv_data;
314.     int16_t *samples;
315.     GetBitContext *gb = &s->gb;
         ^
316.     int ret, consumed = 0;
317. 

libavcodec/binkaudio.c:316:5: 
314.     int16_t *samples;
315.     GetBitContext *gb = &s->gb;
316.     int ret, consumed = 0;
         ^
317. 
318.     if (!get_bits_left(gb)) {

libavcodec/binkaudio.c:318:10: 
316.     int ret, consumed = 0;
317. 
318.     if (!get_bits_left(gb)) {
              ^
319.         uint8_t *buf;
320.         /* handle end-of-stream */

libavcodec/get_bits.h:452:1: start of procedure get_bits_left()
  450. }
  451. 
  452. static inline int get_bits_left(GetBitContext *gb)
       ^
  453. {
  454.     return gb->size_in_bits - get_bits_count(gb);

libavcodec/get_bits.h:454:5: 
  452. static inline int get_bits_left(GetBitContext *gb)
  453. {
  454.     return gb->size_in_bits - get_bits_count(gb);
           ^
  455. }
  456. 

libavcodec/get_bits.h:162:1: start of procedure get_bits_count()
    160. #   define GET_CACHE(name, gb) ((uint32_t)name##_cache)
    161. 
    162. static inline int get_bits_count(const GetBitContext *s){
         ^
    163.     return s->index;
    164. }

libavcodec/get_bits.h:163:5: 
    161. 
    162. static inline int get_bits_count(const GetBitContext *s){
    163.     return s->index;
             ^
    164. }
    165. 

libavcodec/get_bits.h:164:1: return from a call to get_bits_count
    162. static inline int get_bits_count(const GetBitContext *s){
    163.     return s->index;
    164. }
         ^
    165. 
    166. static inline void skip_bits_long(GetBitContext *s, int n){

libavcodec/get_bits.h:455:1: return from a call to get_bits_left
  453. {
  454.     return gb->size_in_bits - get_bits_count(gb);
  455. }
       ^
  456. 
  457. //#define TRACE

libavcodec/binkaudio.c:318:10: Taking true branch
316.     int ret, consumed = 0;
317. 
318.     if (!get_bits_left(gb)) {
              ^
319.         uint8_t *buf;
320.         /* handle end-of-stream */

libavcodec/binkaudio.c:321:14: Taking false branch
319.         uint8_t *buf;
320.         /* handle end-of-stream */
321.         if (!avpkt->size) {
                  ^
322.             *got_frame_ptr = 0;
323.             return 0;

libavcodec/binkaudio.c:325:13: Taking false branch
323.             return 0;
324.         }
325.         if (avpkt->size < 4) {
                 ^
326.             av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
327.             return AVERROR_INVALIDDATA;

libavcodec/binkaudio.c:329:9: 
327.             return AVERROR_INVALIDDATA;
328.         }
329.         buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
             ^
330.         if (!buf)
331.             return AVERROR(ENOMEM);

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

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

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

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

libavcodec/binkaudio.c:330:14: Taking false branch
328.         }
329.         buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
330.         if (!buf)
                  ^
331.             return AVERROR(ENOMEM);
332.         s->packet_buffer = buf;

libavcodec/binkaudio.c:332:9: 
330.         if (!buf)
331.             return AVERROR(ENOMEM);
332.         s->packet_buffer = buf;
             ^
333.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
334.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);

libavcodec/binkaudio.c:333:9: 
331.             return AVERROR(ENOMEM);
332.         s->packet_buffer = buf;
333.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
             ^
334.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
335.         consumed = avpkt->size;

libavcodec/binkaudio.c:334:9: 
332.         s->packet_buffer = buf;
333.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
334.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
             ^
335.         consumed = avpkt->size;
336. 

libavcodec/get_bits.h:306:1: start of procedure init_get_bits()
  304.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  305.  */
  306. static inline void init_get_bits(GetBitContext *s,
       ^
  307.                    const uint8_t *buffer, int bit_size)
  308. {

libavcodec/get_bits.h:309:5: 
  307.                    const uint8_t *buffer, int bit_size)
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
           ^
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:310:9: Taking false branch
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
               ^
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;

libavcodec/get_bits.h:310:28: Taking false branch
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
                                  ^
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;

libavcodec/get_bits.h:315:5: 
  313.     }
  314. 
  315.     s->buffer       = buffer;
           ^
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;

libavcodec/get_bits.h:316:5: 
  314. 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
           ^
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;

libavcodec/get_bits.h:317:5: 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
           ^
  318.     s->index        = 0;
  319. }

libavcodec/get_bits.h:318:5: 
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
           ^
  319. }
  320. 

libavcodec/get_bits.h:319:1: return from a call to init_get_bits
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
  319. }
       ^
  320. 
  321. static inline void align_get_bits(GetBitContext *s)

libavcodec/binkaudio.c:335:9: 
333.         memcpy(s->packet_buffer, avpkt->data, avpkt->size);
334.         init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
335.         consumed = avpkt->size;
             ^
336. 
337.         /* skip reported size */

libavcodec/binkaudio.c:338:9: 
336. 
337.         /* skip reported size */
338.         skip_bits_long(gb, 32);
             ^
339.     }
340. 

libavcodec/get_bits.h:166:1: start of procedure skip_bits_long()
  164. }
  165. 
  166. static inline void skip_bits_long(GetBitContext *s, int n){
       ^
  167.     s->index += n;
  168. }

libavcodec/get_bits.h:167:5: 
  165. 
  166. static inline void skip_bits_long(GetBitContext *s, int n){
  167.     s->index += n;
           ^
  168. }
  169. 

libavcodec/get_bits.h:168:1: return from a call to skip_bits_long
  166. static inline void skip_bits_long(GetBitContext *s, int n){
  167.     s->index += n;
  168. }
       ^
  169. 
  170. /**

libavcodec/binkaudio.c:342:5: 
340. 
341.     /* get output buffer */
342.     s->frame.nb_samples = s->block_size / avctx->channels;
         ^
343.     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
344.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

libavcodec/binkaudio.c:343:9: Taking false branch
341.     /* get output buffer */
342.     s->frame.nb_samples = s->block_size / avctx->channels;
343.     if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
             ^
344.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
345.         return ret;

libavcodec/binkaudio.c:347:5: 
345.         return ret;
346.     }
347.     samples = (int16_t *)s->frame.data[0];
         ^
348. 
349.     if (decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT)) {

libavcodec/binkaudio.c:349:34: Condition is false
347.     samples = (int16_t *)s->frame.data[0];
348. 
349.     if (decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT)) {
                                      ^
350.         av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
351.         return AVERROR_INVALIDDATA;

libavcodec/binkaudio.c:349:9: Skipping decode_block(): empty list of specs
347.     samples = (int16_t *)s->frame.data[0];
348. 
349.     if (decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT)) {
             ^
350.         av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
351.         return AVERROR_INVALIDDATA;

static int decode_frame(AVCodecContext *avctx, void *data,
                        int *got_frame_ptr, AVPacket *avpkt)
{
    BinkAudioContext *s = avctx->priv_data;
    int16_t *samples;
    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->block_size / avctx->channels;
    if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return ret;
    }
    samples = (int16_t *)s->frame.data[0];
    if (decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT)) {
        av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
        return AVERROR_INVALIDDATA;
    }
    get_bits_align32(gb);
    *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    int16_t *samples;\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->block_size / avctx->channels;\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    samples = (int16_t *)s->frame.data[0];\n    if (decode_block(s, samples, avctx->codec->id == 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    *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    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) return av_malloc(size);\n    diff= ((char*)ptr)[-1];\n    return (char*)realloc((char*)ptr - diff, size + diff) + diff;\n#else\n    return realloc(ptr, size);\n#endif\n}', 'static inline void init_get_bits(GetBitContext *s,\n                   const uint8_t *buffer, 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    s->buffer_end   = buffer + buffer_size;\n    s->index        = 0;\n}', 'static inline void skip_bits_long(GetBitContext *s, int n){\n    s->index += n;\n}']