libavcodec/parser.c:206: error: Null Dereference
  pointer `*poutbuf` last assigned on line 204 could be null and is dereferenced by call to `memcpy()` at line 206, column 13.

libavcodec/parser.c:182:1: start of procedure av_parser_change()
180.  * @deprecated use AVBitstreamFilter
181.  */
182. int av_parser_change(AVCodecParserContext *s,
     ^
183.                      AVCodecContext *avctx,
184.                      uint8_t **poutbuf, int *poutbuf_size,

libavcodec/parser.c:187:8: Taking true branch
185.                      const uint8_t *buf, int buf_size, int keyframe){
186. 
187.     if(s && s->parser->split){
            ^
188.         if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
189.             int i= s->parser->split(avctx, buf, buf_size);

libavcodec/parser.c:187:13: Taking true branch
185.                      const uint8_t *buf, int buf_size, int keyframe){
186. 
187.     if(s && s->parser->split){
                 ^
188.         if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
189.             int i= s->parser->split(avctx, buf, buf_size);

libavcodec/parser.c:188:13: Taking true branch
186. 
187.     if(s && s->parser->split){
188.         if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
                 ^
189.             int i= s->parser->split(avctx, buf, buf_size);
190.             buf += i;

libavcodec/parser.c:189:13: Skipping __function_pointer__(): unresolved function pointer
187.     if(s && s->parser->split){
188.         if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
189.             int i= s->parser->split(avctx, buf, buf_size);
                 ^
190.             buf += i;
191.             buf_size -= i;

libavcodec/parser.c:190:13: 
188.         if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
189.             int i= s->parser->split(avctx, buf, buf_size);
190.             buf += i;
                 ^
191.             buf_size -= i;
192.         }

libavcodec/parser.c:191:13: 
189.             int i= s->parser->split(avctx, buf, buf_size);
190.             buf += i;
191.             buf_size -= i;
                 ^
192.         }
193.     }

libavcodec/parser.c:196:5: 
194. 
195.     /* cast to avoid warning about discarding qualifiers */
196.     *poutbuf= (uint8_t *) buf;
         ^
197.     *poutbuf_size= buf_size;
198.     if(avctx->extradata){

libavcodec/parser.c:197:5: 
195.     /* cast to avoid warning about discarding qualifiers */
196.     *poutbuf= (uint8_t *) buf;
197.     *poutbuf_size= buf_size;
         ^
198.     if(avctx->extradata){
199.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))

libavcodec/parser.c:198:8: Taking true branch
196.     *poutbuf= (uint8_t *) buf;
197.     *poutbuf_size= buf_size;
198.     if(avctx->extradata){
            ^
199.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
200.             /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/

libavcodec/parser.c:199:15: Taking true branch
197.     *poutbuf_size= buf_size;
198.     if(avctx->extradata){
199.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
                   ^
200.             /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
201.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){

libavcodec/parser.c:199:28: Taking true branch
197.     *poutbuf_size= buf_size;
198.     if(avctx->extradata){
199.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
                                ^
200.             /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
201.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){

libavcodec/parser.c:202:13: 
200.             /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
201.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
202.             int size= buf_size + avctx->extradata_size;
                 ^
203.             *poutbuf_size= size;
204.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/parser.c:203:13: 
201.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
202.             int size= buf_size + avctx->extradata_size;
203.             *poutbuf_size= size;
                 ^
204.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
205. 

libavcodec/parser.c:204:13: 
202.             int size= buf_size + avctx->extradata_size;
203.             *poutbuf_size= size;
204.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
                 ^
205. 
206.             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);

libavutil/mem.c:47:1: start of procedure av_malloc()
  45.    linker will do it automatically. */
  46. 
  47. void *av_malloc(unsigned int size)
      ^
  48. {
  49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
  47. void *av_malloc(unsigned int size)
  48. {
  49.     void *ptr = NULL;
          ^
  50. #if CONFIG_MEMALIGN_HACK
  51.     long diff;

libavutil/mem.c:55:8: Taking true branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:56:9: 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
  56.         return NULL;
              ^
  57. 
  58. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:100:1: return from a call to av_malloc
   98. #endif
   99.     return ptr;
  100. }
       ^
  101. 
  102. void *av_realloc(void *ptr, unsigned int size)

libavcodec/parser.c:206:13: 
204.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
205. 
206.             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
                 ^
207.             memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
208.             return 1;

int av_parser_change(AVCodecParserContext *s,
                     AVCodecContext *avctx,
                     uint8_t **poutbuf, int *poutbuf_size,
                     const uint8_t *buf, int buf_size, int keyframe){
    if(s && s->parser->split){
        if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
            int i= s->parser->split(avctx, buf, buf_size);
            buf += i;
            buf_size -= i;
        }
    }
    *poutbuf= (uint8_t *) buf;
    *poutbuf_size= buf_size;
    if(avctx->extradata){
        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
             ){
            int size= buf_size + avctx->extradata_size;
            *poutbuf_size= size;
            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
            return 1;
        }
    }
    return 0;
}
['int av_parser_change(AVCodecParserContext *s,\n                     AVCodecContext *avctx,\n                     uint8_t **poutbuf, int *poutbuf_size,\n                     const uint8_t *buf, int buf_size, int keyframe){\n    if(s && s->parser->split){\n        if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){\n            int i= s->parser->split(avctx, buf, buf_size);\n            buf += i;\n            buf_size -= i;\n        }\n    }\n    *poutbuf= (uint8_t *) buf;\n    *poutbuf_size= buf_size;\n    if(avctx->extradata){\n        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))\n             ){\n            int size= buf_size + avctx->extradata_size;\n            *poutbuf_size= size;\n            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);\n            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);\n            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n            return 1;\n        }\n    }\n    return 0;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']