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

libavformat/rtpdec.c:374:1: start of procedure rtp_parse_mp4_au()
372. }
373. 
374. static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
     ^
375. {
376.     int au_headers_length, au_header_size, i;

libavformat/rtpdec.c:380:5: 
378.     RTPPayloadData *infos;
379. 
380.     infos = s->rtp_payload_data;
         ^
381. 
382.     if (infos == NULL)

libavformat/rtpdec.c:382:9: Taking false branch
380.     infos = s->rtp_payload_data;
381. 
382.     if (infos == NULL)
             ^
383.         return -1;
384. 

libavformat/rtpdec.c:387:5: 
385.     /* decode the first 2 bytes where the AUHeader sections are stored
386.        length in bits */
387.     au_headers_length = AV_RB16(buf);
         ^
388. 
389.     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:389:9: Taking false branch
387.     au_headers_length = AV_RB16(buf);
388. 
389.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)
             ^
390.       return -1;
391. 

libavformat/rtpdec.c:392:5: 
390.       return -1;
391. 
392.     infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
         ^
393. 
394.     /* skip AU headers length section (2 bytes) */

libavformat/rtpdec.c:395:5: 
393. 
394.     /* skip AU headers length section (2 bytes) */
395.     buf += 2;
         ^
396. 
397.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);

libavformat/rtpdec.c:397:5: 
395.     buf += 2;
396. 
397.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
         ^
398. 
399.     /* 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:400:5: 
398. 
399.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
400.     au_header_size = infos->sizelength + infos->indexlength;
         ^
401.     if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
402.         return -1;

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

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

libavformat/rtpdec.c:404:5: 
402.         return -1;
403. 
404.     infos->nb_au_headers = au_headers_length / au_header_size;
         ^
405.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
406. 

libavformat/rtpdec.c:405:5: 
403. 
404.     infos->nb_au_headers = au_headers_length / au_header_size;
405.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
         ^
406. 
407.     /* 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:410:5: 
408.        In my test, the FAAD decoder does not behave correctly when sending each AU one by one
409.        but does when sending the whole as one big packet...  */
410.     infos->au_headers[0].size = 0;
         ^
411.     infos->au_headers[0].index = 0;
412.     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}']