libavcodec/mdec.c:177: error: Null Dereference
  pointer `a->bitstream_buffer` last assigned on line 175 could be null and is dereferenced at line 177, column 9.

libavcodec/mdec.c:155:1: start of procedure decode_frame()
153. }
154. 
155. static int decode_frame(AVCodecContext *avctx,
     ^
156.                         void *data, int *data_size,
157.                         const uint8_t *buf, int buf_size)

libavcodec/mdec.c:159:5: 
157.                         const uint8_t *buf, int buf_size)
158. {
159.     MDECContext * const a = avctx->priv_data;
         ^
160.     AVFrame *picture = data;
161.     AVFrame * const p= &a->picture;

libavcodec/mdec.c:160:5: 
158. {
159.     MDECContext * const a = avctx->priv_data;
160.     AVFrame *picture = data;
         ^
161.     AVFrame * const p= &a->picture;
162.     int i;

libavcodec/mdec.c:161:5: 
159.     MDECContext * const a = avctx->priv_data;
160.     AVFrame *picture = data;
161.     AVFrame * const p= &a->picture;
         ^
162.     int i;
163. 

libavcodec/mdec.c:164:8: Taking true branch
162.     int i;
163. 
164.     if(p->data[0])
            ^
165.         avctx->release_buffer(avctx, p);
166. 

libavcodec/mdec.c:165:9: Skipping __function_pointer__(): unresolved function pointer
163. 
164.     if(p->data[0])
165.         avctx->release_buffer(avctx, p);
             ^
166. 
167.     p->reference= 0;

libavcodec/mdec.c:167:5: 
165.         avctx->release_buffer(avctx, p);
166. 
167.     p->reference= 0;
         ^
168.     if(avctx->get_buffer(avctx, p) < 0){
169.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

libavcodec/mdec.c:168:8: Taking false branch
166. 
167.     p->reference= 0;
168.     if(avctx->get_buffer(avctx, p) < 0){
            ^
169.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
170.         return -1;

libavcodec/mdec.c:172:5: 
170.         return -1;
171.     }
172.     p->pict_type= FF_I_TYPE;
         ^
173.     p->key_frame= 1;
174. 

libavcodec/mdec.c:173:5: 
171.     }
172.     p->pict_type= FF_I_TYPE;
173.     p->key_frame= 1;
         ^
174. 
175.     a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/mdec.c:175:5: 
173.     p->key_frame= 1;
174. 
175.     a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
         ^
176.     for(i=0; i<buf_size; i+=2){
177.         a->bitstream_buffer[i]  = buf[i+1];

libavcodec/utils.c:69:1: start of procedure av_fast_realloc()
  67. static int volatile entangled_thread_counter=0;
  68. 
  69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
      ^
  70. {
  71.     if(min_size < *size)

libavcodec/utils.c:71:8: Taking false branch
  69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
  70. {
  71.     if(min_size < *size)
             ^
  72.         return ptr;
  73. 

libavcodec/utils.c:74:12: Condition is false
  72.         return ptr;
  73. 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
                 ^
  75. 
  76.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:74:5: 
  72.         return ptr;
  73. 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
          ^
  75. 
  76.     ptr= av_realloc(ptr, *size);

libavcodec/utils.c:76:5: 
  74.     *size= FFMAX(17*min_size/16 + 32, min_size);
  75. 
  76.     ptr= av_realloc(ptr, *size);
          ^
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
  78.         *size= 0;

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

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

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

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

libavcodec/utils.c:77:9: Taking true branch
  75. 
  76.     ptr= av_realloc(ptr, *size);
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
              ^
  78.         *size= 0;
  79. 

libavcodec/utils.c:78:9: 
  76.     ptr= av_realloc(ptr, *size);
  77.     if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
  78.         *size= 0;
              ^
  79. 
  80.     return ptr;

libavcodec/utils.c:80:5: 
  78.         *size= 0;
  79. 
  80.     return ptr;
          ^
  81. }
  82. 

libavcodec/utils.c:81:1: return from a call to av_fast_realloc
  79. 
  80.     return ptr;
  81. }
      ^
  82. 
  83. /* encoder management */

libavcodec/mdec.c:176:9: 
174. 
175.     a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
176.     for(i=0; i<buf_size; i+=2){
             ^
177.         a->bitstream_buffer[i]  = buf[i+1];
178.         a->bitstream_buffer[i+1]= buf[i  ];

libavcodec/mdec.c:176:14: Loop condition is true. Entering loop body
174. 
175.     a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
176.     for(i=0; i<buf_size; i+=2){
                  ^
177.         a->bitstream_buffer[i]  = buf[i+1];
178.         a->bitstream_buffer[i+1]= buf[i  ];

libavcodec/mdec.c:177:9: 
175.     a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
176.     for(i=0; i<buf_size; i+=2){
177.         a->bitstream_buffer[i]  = buf[i+1];
             ^
178.         a->bitstream_buffer[i+1]= buf[i  ];
179.     }

static int decode_frame(AVCodecContext *avctx,
                        void *data, int *data_size,
                        const uint8_t *buf, int buf_size)
{
    MDECContext * const a = avctx->priv_data;
    AVFrame *picture = data;
    AVFrame * const p= &a->picture;
    int i;
    if(p->data[0])
        avctx->release_buffer(avctx, p);
    p->reference= 0;
    if(avctx->get_buffer(avctx, p) < 0){
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return -1;
    }
    p->pict_type= FF_I_TYPE;
    p->key_frame= 1;
    a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
    for(i=0; i<buf_size; i+=2){
        a->bitstream_buffer[i]  = buf[i+1];
        a->bitstream_buffer[i+1]= buf[i  ];
    }
    init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
    skip_bits(&a->gb, 32);
    a->qscale=  get_bits(&a->gb, 16);
    a->version= get_bits(&a->gb, 16);
    a->last_dc[0]=
    a->last_dc[1]=
    a->last_dc[2]= 128;
    for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){
        for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){
            if( decode_mb(a, a->block) <0)
                return -1;
            idct_put(a, a->mb_x, a->mb_y);
        }
    }
    p->quality= a->qscale * FF_QP2LAMBDA;
    memset(p->qscale_table, a->qscale, p->qstride*a->mb_height);
    *picture   = a->picture;
    *data_size = sizeof(AVPicture);
    return (get_bits_count(&a->gb)+31)/32*4;
}
['static int decode_frame(AVCodecContext *avctx,\n                        void *data, int *data_size,\n                        const uint8_t *buf, int buf_size)\n{\n    MDECContext * const a = avctx->priv_data;\n    AVFrame *picture = data;\n    AVFrame * const p= &a->picture;\n    int i;\n    if(p->data[0])\n        avctx->release_buffer(avctx, p);\n    p->reference= 0;\n    if(avctx->get_buffer(avctx, p) < 0){\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return -1;\n    }\n    p->pict_type= FF_I_TYPE;\n    p->key_frame= 1;\n    a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n    for(i=0; i<buf_size; i+=2){\n        a->bitstream_buffer[i]  = buf[i+1];\n        a->bitstream_buffer[i+1]= buf[i  ];\n    }\n    init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);\n    skip_bits(&a->gb, 32);\n    a->qscale=  get_bits(&a->gb, 16);\n    a->version= get_bits(&a->gb, 16);\n    a->last_dc[0]=\n    a->last_dc[1]=\n    a->last_dc[2]= 128;\n    for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){\n        for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){\n            if( decode_mb(a, a->block) <0)\n                return -1;\n            idct_put(a, a->mb_x, a->mb_y);\n        }\n    }\n    p->quality= a->qscale * FF_QP2LAMBDA;\n    memset(p->qscale_table, a->qscale, p->qstride*a->mb_height);\n    *picture   = a->picture;\n    *data_size = sizeof(AVPicture);\n    return (get_bits_count(&a->gb)+31)/32*4;\n}', 'void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)\n{\n    if(min_size < *size)\n        return ptr;\n    *size= FFMAX(17*min_size/16 + 32, min_size);\n    ptr= av_realloc(ptr, *size);\n    if(!ptr)\n        *size= 0;\n    return ptr;\n}', 'void *av_realloc(void *ptr, unsigned int 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}']