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

libavformat/rtpdec.c:328:1: start of procedure rtp_parse_mp4_au()
326. }
327. 
328. static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
     ^
329. {
330.     int au_headers_length, au_header_size, i;

libavformat/rtpdec.c:334:5: 
332.     RTPPayloadData *infos;
333. 
334.     infos = s->rtp_payload_data;
         ^
335. 
336.     if (infos == NULL)

libavformat/rtpdec.c:336:9: Taking false branch
334.     infos = s->rtp_payload_data;
335. 
336.     if (infos == NULL)
             ^
337.         return -1;
338. 

libavformat/rtpdec.c:341:5: 
339.     /* decode the first 2 bytes where the AUHeader sections are stored
340.        length in bits */
341.     au_headers_length = AV_RB16(buf);
         ^
342. 
343.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)

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

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

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

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

libavformat/rtpdec.c:343:9: Taking false branch
341.     au_headers_length = AV_RB16(buf);
342. 
343.     if (au_headers_length > RTP_MAX_PACKET_LENGTH)
             ^
344.       return -1;
345. 

libavformat/rtpdec.c:346:5: 
344.       return -1;
345. 
346.     infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
         ^
347. 
348.     /* skip AU headers length section (2 bytes) */

libavformat/rtpdec.c:349:5: 
347. 
348.     /* skip AU headers length section (2 bytes) */
349.     buf += 2;
         ^
350. 
351.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);

libavformat/rtpdec.c:351:5: 
349.     buf += 2;
350. 
351.     init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
         ^
352. 
353.     /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */

libavcodec/get_bits.h:493:1: start of procedure init_get_bits()
  491.  * @param bit_size the size of the buffer in bits
  492.  */
  493. static inline void init_get_bits(GetBitContext *s,
       ^
  494.                    const uint8_t *buffer, int bit_size)
  495. {

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

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

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

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

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

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

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

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

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

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

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

libavformat/rtpdec.c:358:5: 
356.         return -1;
357. 
358.     infos->nb_au_headers = au_headers_length / au_header_size;
         ^
359.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
360. 

libavformat/rtpdec.c:359:5: 
357. 
358.     infos->nb_au_headers = au_headers_length / au_header_size;
359.     infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
         ^
360. 
361.     /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)

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)

libavformat/rtpdec.c:364:5: 
362.        In my test, the FAAD decoder does not behave correctly when sending each AU one by one
363.        but does when sending the whole as one big packet...  */
364.     infos->au_headers[0].size = 0;
         ^
365.     infos->au_headers[0].index = 0;
366.     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}']