libavformat/rtpdec.c:347: error: Null Dereference
  pointer `infos->au_headers` last assigned on line 342 could be null and is dereferenced at line 347, column 5.

libavformat/rtpdec.c:311:1: start of procedure rtp_parse_mp4_au()
309. }
310. 
311. static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
     ^
312. {
313.     int au_headers_length, au_header_size, i;

libavformat/rtpdec.c:317:5: 
315.     rtp_payload_data_t *infos;
316. 
317.     infos = s->rtp_payload_data;
         ^
318. 
319.     if (infos == NULL)

libavformat/rtpdec.c:319:9: Taking false branch
317.     infos = s->rtp_payload_data;
318. 
319.     if (infos == NULL)
             ^
320.         return -1;
321. 

libavformat/rtpdec.c:324:5: 
322.     /* decode the first 2 bytes where the AUHeader sections are stored
323.        length in bits */
324.     au_headers_length = AV_RB16(buf);
         ^
325. 
326.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)

libavformat/rtpdec.c:326:9: Taking false branch
324.     au_headers_length = AV_RB16(buf);
325. 
326.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)
             ^
327.       return -1;
328. 

libavformat/rtpdec.c:329:5: 
327.       return -1;
328. 
329.     infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
         ^
330. 
331.     /* skip AU headers length section (2 bytes) */

libavformat/rtpdec.c:332:5: 
330. 
331.     /* skip AU headers length section (2 bytes) */
332.     buf += 2;
         ^
333. 
334.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);

libavformat/rtpdec.c:334:5: 
332.     buf += 2;
333. 
334.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
         ^
335. 
336.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */

libavcodec/bitstream.h:758:1: start of procedure init_get_bits()
  756.  * @param bit_size the size of the buffer in bits
  757.  */
  758. static inline void init_get_bits(GetBitContext *s,
       ^
  759.                    const uint8_t *buffer, int bit_size)
  760. {

libavcodec/bitstream.h:761:5: 
  759.                    const uint8_t *buffer, int bit_size)
  760. {
  761.     int buffer_size= (bit_size+7)>>3;
           ^
  762.     if(buffer_size < 0 || bit_size < 0) {
  763.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:762:8: Taking false branch
  760. {
  761.     int buffer_size= (bit_size+7)>>3;
  762.     if(buffer_size < 0 || bit_size < 0) {
              ^
  763.         buffer_size = bit_size = 0;
  764.         buffer = NULL;

libavcodec/bitstream.h:762:27: Taking false branch
  760. {
  761.     int buffer_size= (bit_size+7)>>3;
  762.     if(buffer_size < 0 || bit_size < 0) {
                                 ^
  763.         buffer_size = bit_size = 0;
  764.         buffer = NULL;

libavcodec/bitstream.h:767:5: 
  765.     }
  766. 
  767.     s->buffer= buffer;
           ^
  768.     s->size_in_bits= bit_size;
  769.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:768:5: 
  766. 
  767.     s->buffer= buffer;
  768.     s->size_in_bits= bit_size;
           ^
  769.     s->buffer_end= buffer + buffer_size;
  770. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:769:5: 
  767.     s->buffer= buffer;
  768.     s->size_in_bits= bit_size;
  769.     s->buffer_end= buffer + buffer_size;
           ^
  770. #ifdef ALT_BITSTREAM_READER
  771.     s->index=0;

libavcodec/bitstream.h:771:5: 
  769.     s->buffer_end= buffer + buffer_size;
  770. #ifdef ALT_BITSTREAM_READER
  771.     s->index=0;
           ^
  772. #elif defined LIBMPEG2_BITSTREAM_READER
  773.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:781:1: return from a call to init_get_bits
  779.     skip_bits_long(s, 0);
  780. #endif
  781. }
       ^
  782. 
  783. static inline void align_get_bits(GetBitContext *s)

libavformat/rtpdec.c:337:5: 
335. 
336.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
337.     au_header_size = infos->sizelength + infos->indexlength;
         ^
338.     if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
339.         return -1;

libavformat/rtpdec.c:338:9: Taking false branch
336.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
337.     au_header_size = infos->sizelength + infos->indexlength;
338.     if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
             ^
339.         return -1;
340. 

libavformat/rtpdec.c:338:33: Taking false branch
336.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
337.     au_header_size = infos->sizelength + infos->indexlength;
338.     if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
                                     ^
339.         return -1;
340. 

libavformat/rtpdec.c:341:5: 
339.         return -1;
340. 
341.     infos->nb_au_headers = au_headers_length / au_header_size;
         ^
342.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
343. 

libavformat/rtpdec.c:342:5: 
340. 
341.     infos->nb_au_headers = au_headers_length / au_header_size;
342.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
         ^
343. 
344.     /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)

libavutil/mem.c:42:1: start of procedure av_malloc()
  40.    linker will do it automatically */
  41. 
  42. void *av_malloc(unsigned int size)
      ^
  43. {
  44.     void *ptr;

libavutil/mem.c:50:8: Taking true branch
  48. 
  49.     /* let's disallow possible ambiguous cases */
  50.     if(size > (INT_MAX-16) )
             ^
  51.         return NULL;
  52. 

libavutil/mem.c:51:9: 
  49.     /* let's disallow possible ambiguous cases */
  50.     if(size > (INT_MAX-16) )
  51.         return NULL;
              ^
  52. 
  53. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:92:1: return from a call to av_malloc
  90. #endif
  91.     return ptr;
  92. }
      ^
  93. 
  94. void *av_realloc(void *ptr, unsigned int size)

libavformat/rtpdec.c:347:5: 
345.        In my test, the FAAD decoder does not behave correctly when sending each AU one by one
346.        but does when sending the whole as one big packet...  */
347.     infos->au_headers[0].size = 0;
         ^
348.     infos->au_headers[0].index = 0;
349.     for (i = 0; i < infos->nb_au_headers; ++i) {

static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
{
    int au_headers_length, au_header_size, i;
    GetBitContext getbitcontext;
    rtp_payload_data_t *infos;
    infos = s->rtp_payload_data;
    if (infos == NULL)
        return -1;
    au_headers_length = AV_RB16(buf);
    if (au_headers_length > RTP_MAX_PACKET_LENGTH)
      return -1;
    infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
    buf += 2;
    init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
    au_header_size = infos->sizelength + infos->indexlength;
    if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
        return -1;
    infos->nb_au_headers = au_headers_length / au_header_size;
    infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
    infos->au_headers[0].size = 0;
    infos->au_headers[0].index = 0;
    for (i = 0; i < infos->nb_au_headers; ++i) {
        infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);
        infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);
    }
    infos->nb_au_headers = 1;
    return 0;
}
['static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)\n{\n    int au_headers_length, au_header_size, i;\n    GetBitContext getbitcontext;\n    rtp_payload_data_t *infos;\n    infos = s->rtp_payload_data;\n    if (infos == NULL)\n        return -1;\n    au_headers_length = AV_RB16(buf);\n    if (au_headers_length > RTP_MAX_PACKET_LENGTH)\n      return -1;\n    infos->au_headers_length_bytes = (au_headers_length + 7) / 8;\n    buf += 2;\n    init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);\n    au_header_size = infos->sizelength + infos->indexlength;\n    if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))\n        return -1;\n    infos->nb_au_headers = au_headers_length / au_header_size;\n    infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);\n    infos->au_headers[0].size = 0;\n    infos->au_headers[0].index = 0;\n    for (i = 0; i < infos->nb_au_headers; ++i) {\n        infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);\n        infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);\n    }\n    infos->nb_au_headers = 1;\n    return 0;\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#ifdef ALT_BITSTREAM_READER\n    s->index=0;\n#elif defined LIBMPEG2_BITSTREAM_READER\n    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));\n    s->bit_count = 16 + 8*((intptr_t)buffer&1);\n    skip_bits_long(s, 0);\n#elif defined A32_BITSTREAM_READER\n    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));\n    s->bit_count = 32 + 8*((intptr_t)buffer&3);\n    skip_bits_long(s, 0);\n#endif\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef 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 defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']