libavcodec/qdm2.c:1221: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 1220 could be null and is dereferenced by call to `qdm2_decode_sub_packet_header()` at line 1221, column 5.

libavcodec/qdm2.c:1204:1: start of procedure qdm2_decode_super_block()
1202.  * @param q    context
1203.  */
1204. static void qdm2_decode_super_block (QDM2Context *q)
      ^
1205. {
1206.     GetBitContext gb;

libavcodec/qdm2.c:1209:5: 
1207.     QDM2SubPacket header, *packet;
1208.     int i, packet_bytes, sub_packet_size, sub_packets_D;
1209.     unsigned int next_index = 0;
          ^
1210. 
1211.     memset(q->tone_level_idx_hi1, 0, sizeof(q->tone_level_idx_hi1));

libavcodec/qdm2.c:1211:5: 
1209.     unsigned int next_index = 0;
1210. 
1211.     memset(q->tone_level_idx_hi1, 0, sizeof(q->tone_level_idx_hi1));
          ^
1212.     memset(q->tone_level_idx_mid, 0, sizeof(q->tone_level_idx_mid));
1213.     memset(q->tone_level_idx_hi2, 0, sizeof(q->tone_level_idx_hi2));

libavcodec/qdm2.c:1212:5: 
1210. 
1211.     memset(q->tone_level_idx_hi1, 0, sizeof(q->tone_level_idx_hi1));
1212.     memset(q->tone_level_idx_mid, 0, sizeof(q->tone_level_idx_mid));
          ^
1213.     memset(q->tone_level_idx_hi2, 0, sizeof(q->tone_level_idx_hi2));
1214. 

libavcodec/qdm2.c:1213:5: 
1211.     memset(q->tone_level_idx_hi1, 0, sizeof(q->tone_level_idx_hi1));
1212.     memset(q->tone_level_idx_mid, 0, sizeof(q->tone_level_idx_mid));
1213.     memset(q->tone_level_idx_hi2, 0, sizeof(q->tone_level_idx_hi2));
          ^
1214. 
1215.     q->sub_packets_B = 0;

libavcodec/qdm2.c:1215:5: 
1213.     memset(q->tone_level_idx_hi2, 0, sizeof(q->tone_level_idx_hi2));
1214. 
1215.     q->sub_packets_B = 0;
          ^
1216.     sub_packets_D = 0;
1217. 

libavcodec/qdm2.c:1216:5: 
1214. 
1215.     q->sub_packets_B = 0;
1216.     sub_packets_D = 0;
          ^
1217. 
1218.     average_quantized_coeffs(q); // average elements in quantized_coeffs[max_ch][10][8]

libavcodec/qdm2.c:1218:5: Skipping average_quantized_coeffs(): empty list of specs
1216.     sub_packets_D = 0;
1217. 
1218.     average_quantized_coeffs(q); // average elements in quantized_coeffs[max_ch][10][8]
          ^
1219. 
1220.     init_get_bits(&gb, q->compressed_data, q->compressed_size*8);

libavcodec/qdm2.c:1220:5: 
1218.     average_quantized_coeffs(q); // average elements in quantized_coeffs[max_ch][10][8]
1219. 
1220.     init_get_bits(&gb, q->compressed_data, q->compressed_size*8);
          ^
1221.     qdm2_decode_sub_packet_header(&gb, &header);
1222. 

libavcodec/bitstream.h:737:1: start of procedure init_get_bits()
  735.  * @param bit_size the size of the buffer in bits
  736.  */
  737. static inline void init_get_bits(GetBitContext *s,
       ^
  738.                    const uint8_t *buffer, int bit_size)
  739. {

libavcodec/bitstream.h:740:5: 
  738.                    const uint8_t *buffer, int bit_size)
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
           ^
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:741:8: Taking true branch
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
              ^
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;

libavcodec/bitstream.h:742:9: 
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
               ^
  743.         buffer = NULL;
  744.     }

libavcodec/bitstream.h:743:9: 
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;
               ^
  744.     }
  745. 

libavcodec/bitstream.h:746:5: 
  744.     }
  745. 
  746.     s->buffer= buffer;
           ^
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:747:5: 
  745. 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
           ^
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:748:5: 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;
           ^
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;

libavcodec/bitstream.h:750:5: 
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;
           ^
  751. #elif defined LIBMPEG2_BITSTREAM_READER
  752.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:760:1: return from a call to init_get_bits
  758.     skip_bits_long(s, 0);
  759. #endif
  760. }
       ^
  761. 
  762. static inline void align_get_bits(GetBitContext *s)

libavcodec/qdm2.c:1221:5: 
1219. 
1220.     init_get_bits(&gb, q->compressed_data, q->compressed_size*8);
1221.     qdm2_decode_sub_packet_header(&gb, &header);
          ^
1222. 
1223.     if (header.type < 2 || header.type >= 8) {

libavcodec/qdm2.c:414:1: start of procedure qdm2_decode_sub_packet_header()
  412.  * @param sub_packet    packet under analysis
  413.  */
  414. static void qdm2_decode_sub_packet_header (GetBitContext *gb, QDM2SubPacket *sub_packet)
       ^
  415. {
  416.     sub_packet->type = get_bits (gb, 8);

libavcodec/qdm2.c:416:5: 
  414. static void qdm2_decode_sub_packet_header (GetBitContext *gb, QDM2SubPacket *sub_packet)
  415. {
  416.     sub_packet->type = get_bits (gb, 8);
           ^
  417. 
  418.     if (sub_packet->type == 0) {

libavcodec/bitstream.h:634:1: start of procedure get_bits()
    632.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
    633.  */
    634. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    635.     register int tmp;
    636.     OPEN_READER(re, s)

libavcodec/bitstream.h:636:5: 
    634. static inline unsigned int get_bits(GetBitContext *s, int n){
    635.     register int tmp;
    636.     OPEN_READER(re, s)
             ^
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:637:5: 
    635.     register int tmp;
    636.     OPEN_READER(re, s)
    637.     UPDATE_CACHE(re, s)
             ^
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)
