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

libavformat/rtpdec.c:335:1: start of procedure rtp_parse_mp4_au()
333. }
334. 
335. static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
     ^
336. {
337.     int au_headers_length, au_header_size, i;

libavformat/rtpdec.c:341:5: 
339.     RTPPayloadData *infos;
340. 
341.     infos = s->rtp_payload_data;
         ^
342. 
343.     if (infos == NULL)

libavformat/rtpdec.c:343:9: Taking false branch
341.     infos = s->rtp_payload_data;
342. 
343.     if (infos == NULL)
             ^
344.         return -1;
345. 

libavformat/rtpdec.c:348:5: 
346.     /* decode the first 2 bytes where the AUHeader sections are stored
347.        length in bits */
348.     au_headers_length = AV_RB16(buf);
         ^
349. 
350.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)

libavutil/bswap.h:46:1: start of procedure bswap_16()
  44. 
  45. #ifndef bswap_16
  46. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
      ^
  47. {
  48.     x= (x>>8) | (x<<8);

libavutil/bswap.h:48:5: 
  46. static av_always_inline av_const uint16_t bswap_16(uint16_t x)
  47. {
  48.     x= (x>>8) | (x<<8);
          ^
  49.     return x;
  50. }

libavutil/bswap.h:49:5: 
  47. {
  48.     x= (x>>8) | (x<<8);
  49.     return x;
          ^
  50. }
  51. #endif

libavutil/bswap.h:50:1: return from a call to bswap_16
  48.     x= (x>>8) | (x<<8);
  49.     return x;
  50. }
      ^
  51. #endif
  52. 

libavformat/rtpdec.c:350:9: Taking false branch
348.     au_headers_length = AV_RB16(buf);
349. 
350.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)
             ^
351.       return -1;
352. 

libavformat/rtpdec.c:353:5: 
351.       return -1;
352. 
353.     infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
         ^
354. 
355.     /* skip AU headers length section (2 bytes) */

libavformat/rtpdec.c:356:5: 
354. 
355.     /* skip AU headers length section (2 bytes) */
356.     buf += 2;
         ^
357. 
358.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);

libavformat/rtpdec.c:358:5: 
356.     buf += 2;
357. 
358.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
         ^
359. 
360.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */

libavcodec/get_bits.h:494:1: start of procedure init_get_bits()
  492.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  493.  */
  494. static inline void init_get_bits(GetBitContext *s,
       ^
  495.                    const uint8_t *buffer, int bit_size)
  496. {

libavcodec/get_bits.h:497:5: 
  495.                    const uint8_t *buffer, int bit_size)
  496. {
  497.     int buffer_size= (bit_size+7)>>3;
           ^
  498.     if(buffer_size < 0 || bit_size < 0) {
  499.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:498:8: Taking false branch
  496. {
  497.     int buffer_size= (bit_size+7)>>3;
  498.     if(buffer_size < 0 || bit_size < 0) {
              ^
  499.         buffer_size = bit_size = 0;
  500.         buffer = NULL;

libavcodec/get_bits.h:498:27: Taking false branch
  496. {
  497.     int buffer_size= (bit_size+7)>>3;
  498.     if(buffer_size < 0 || bit_size < 0) {
                                 ^
  499.         buffer_size = bit_size = 0;
  500.         buffer = NULL;

libavcodec/get_bits.h:503:5: 
  501.     }
  502. 
  503.     s->buffer= buffer;
           ^
  504.     s->size_in_bits= bit_size;
  505.     s->buffer_end= buffer + buffer_size;

libavcodec/get_bits.h:504:5: 
  502. 
  503.     s->buffer= buffer;
  504.     s->size_in_bits= bit_size;
           ^
  505.     s->buffer_end= buffer + buffer_size;
  506. #ifdef ALT_BITSTREAM_READER

libavcodec/get_bits.h:505:5: 
  503.     s->buffer= buffer;
  504.     s->size_in_bits= bit_size;
  505.     s->buffer_end= buffer + buffer_size;
           ^
  506. #ifdef ALT_BITSTREAM_READER
  507.     s->index=0;

libavcodec/get_bits.h:507:5: 
  505.     s->buffer_end= buffer + buffer_size;
  506. #ifdef ALT_BITSTREAM_READER
  507.     s->index=0;
           ^
  508. #elif defined LIBMPEG2_BITSTREAM_READER
  509.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/get_bits.h:517:1: return from a call to init_get_bits
  515.     skip_bits_long(s, 0);
  516. #endif
  517. }
       ^
  518. 
  519. static inline void align_get_bits(GetBitContext *s)

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

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

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

libavformat/rtpdec.c:365:5: 
363.         return -1;
364. 
365.     infos->nb_au_headers = au_headers_length / au_header_size;
         ^
366.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
367. 

libavformat/rtpdec.c:366:5: 
364. 
365.     infos->nb_au_headers = au_headers_length / au_header_size;
366.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
         ^
367. 
368.     /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(unsigned int size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(unsigned int size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking true branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:73:9: 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
  73.         return NULL;
              ^
  74. 
  75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
  115. #endif
  116.     return ptr;
  117. }
       ^
  118. 
  119. void *av_realloc(void *ptr, unsigned int size)

libavformat/rtpdec.c:371:5: 
369.        In my test, the FAAD decoder does not behave correctly when sending each AU one by one
370.        but does when sending the whole as one big packet...  */
371.     infos->au_headers[0].size = 0;
         ^
372.     infos->au_headers[0].index = 0;
373.     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;
    RTPPayloadData *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    RTPPayloadData *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 av_always_inline av_const uint16_t bswap_16(uint16_t x)\n{\n    x= (x>>8) | (x<<8);\n    return x;\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 = 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}']