libavcodec/aacenc.c:150: error: Null Dereference
  pointer `&pb->buf_ptr` last assigned on line 142 could be null and is dereferenced by call to `flush_put_bits()` at line 150, column 5.

libavcodec/aacenc.c:137:1: start of procedure put_audio_specific_config()
135.  * @see 1.6.2.1 "Syntax - AudioSpecificConfig"
136.  */
137. static void put_audio_specific_config(AVCodecContext *avctx)
     ^
138. {
139.     PutBitContext pb;

libavcodec/aacenc.c:140:5: 
138. {
139.     PutBitContext pb;
140.     AACEncContext *s = avctx->priv_data;
         ^
141. 
142.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);

libavcodec/aacenc.c:142:5: 
140.     AACEncContext *s = avctx->priv_data;
141. 
142.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
         ^
143.     put_bits(&pb, 5, 2); //object type - AAC-LC
144.     put_bits(&pb, 4, s->samplerate_index); //sample rate index

libavcodec/put_bits.h:60:1: start of procedure init_put_bits()
  58.  * @param buffer_size the size in bytes of buffer
  59.  */
  60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
      ^
  61. {
  62.     if(buffer_size < 0) {

libavcodec/put_bits.h:62:8: Taking true branch
  60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
  61. {
  62.     if(buffer_size < 0) {
             ^
  63.         buffer_size = 0;
  64.         buffer = NULL;

libavcodec/put_bits.h:63:9: 
  61. {
  62.     if(buffer_size < 0) {
  63.         buffer_size = 0;
              ^
  64.         buffer = NULL;
  65.     }

libavcodec/put_bits.h:64:9: 
  62.     if(buffer_size < 0) {
  63.         buffer_size = 0;
  64.         buffer = NULL;
              ^
  65.     }
  66. 

libavcodec/put_bits.h:67:5: 
  65.     }
  66. 
  67.     s->size_in_bits= 8*buffer_size;
          ^
  68.     s->buf = buffer;
  69.     s->buf_end = s->buf + buffer_size;

libavcodec/put_bits.h:68:5: 
  66. 
  67.     s->size_in_bits= 8*buffer_size;
  68.     s->buf = buffer;
          ^
  69.     s->buf_end = s->buf + buffer_size;
  70. #ifdef ALT_BITSTREAM_WRITER

libavcodec/put_bits.h:69:5: 
  67.     s->size_in_bits= 8*buffer_size;
  68.     s->buf = buffer;
  69.     s->buf_end = s->buf + buffer_size;
          ^
  70. #ifdef ALT_BITSTREAM_WRITER
  71.     s->index=0;

libavcodec/put_bits.h:75:5: 
  73. //    memset(buffer, 0, buffer_size);
  74. #else
  75.     s->buf_ptr = s->buf;
          ^
  76.     s->bit_left=32;
  77.     s->bit_buf=0;

libavcodec/put_bits.h:76:5: 
  74. #else
  75.     s->buf_ptr = s->buf;
  76.     s->bit_left=32;
          ^
  77.     s->bit_buf=0;
  78. #endif

libavcodec/put_bits.h:77:5: 
  75.     s->buf_ptr = s->buf;
  76.     s->bit_left=32;
  77.     s->bit_buf=0;
          ^
  78. #endif
  79. }

libavcodec/put_bits.h:79:1: return from a call to init_put_bits
  77.     s->bit_buf=0;
  78. #endif
  79. }
      ^
  80. 
  81. /**

libavcodec/aacenc.c:143:5: 
141. 
142.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
143.     put_bits(&pb, 5, 2); //object type - AAC-LC
         ^
144.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
145.     put_bits(&pb, 4, avctx->channels);

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:144:5: 
142.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
143.     put_bits(&pb, 5, 2); //object type - AAC-LC
144.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
         ^
145.     put_bits(&pb, 4, avctx->channels);
146.     //GASpecificConfig

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:145:5: 
143.     put_bits(&pb, 5, 2); //object type - AAC-LC
144.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
145.     put_bits(&pb, 4, avctx->channels);
         ^
146.     //GASpecificConfig
147.     put_bits(&pb, 1, 0); //frame length - 1024 samples

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:147:5: 
145.     put_bits(&pb, 4, avctx->channels);
146.     //GASpecificConfig
147.     put_bits(&pb, 1, 0); //frame length - 1024 samples
         ^
148.     put_bits(&pb, 1, 0); //does not depend on core coder
149.     put_bits(&pb, 1, 0); //is not extension

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:148:5: 
146.     //GASpecificConfig
147.     put_bits(&pb, 1, 0); //frame length - 1024 samples
148.     put_bits(&pb, 1, 0); //does not depend on core coder
         ^
149.     put_bits(&pb, 1, 0); //is not extension
150.     flush_put_bits(&pb);

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:149:5: 
147.     put_bits(&pb, 1, 0); //frame length - 1024 samples
148.     put_bits(&pb, 1, 0); //does not depend on core coder
149.     put_bits(&pb, 1, 0); //is not extension
         ^
150.     flush_put_bits(&pb);
151. }

libavcodec/put_bits.h:139:1: start of procedure put_bits()
  137. void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
  138. 
  139. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  140. #ifndef ALT_BITSTREAM_WRITER
  141. {

libavcodec/put_bits.h:146:5: 
  144. 
  145.     //    printf("put_bits=%d %x\n", n, value);
  146.     assert(n == 32 || value < (1U << n));
           ^
  147. 
  148.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:148:5: 
  146.     assert(n == 32 || value < (1U << n));
  147. 
  148.     bit_buf = s->bit_buf;
           ^
  149.     bit_left = s->bit_left;
  150. 

libavcodec/put_bits.h:149:5: 
  147. 
  148.     bit_buf = s->bit_buf;
  149.     bit_left = s->bit_left;
           ^
  150. 
  151.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:168:9: Taking true branch
  166.     bit_left-=n;
  167. #else
  168.     if (n < bit_left) {
               ^
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;

libavcodec/put_bits.h:169:9: 
  167. #else
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
               ^
  170.         bit_left-=n;
  171.     } else {

libavcodec/put_bits.h:170:9: 
  168.     if (n < bit_left) {
  169.         bit_buf = (bit_buf<<n) | value;
  170.         bit_left-=n;
               ^
  171.     } else {
  172.         bit_buf<<=bit_left;

libavcodec/put_bits.h:187:5: 
  185. #endif
  186. 
  187.     s->bit_buf = bit_buf;
           ^
  188.     s->bit_left = bit_left;
  189. }

libavcodec/put_bits.h:188:5: 
  186. 
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
           ^
  189. }
  190. #else  /* ALT_BITSTREAM_WRITER defined */

libavcodec/put_bits.h:189:1: return from a call to put_bits
  187.     s->bit_buf = bit_buf;
  188.     s->bit_left = bit_left;
  189. }
       ^
  190. #else  /* ALT_BITSTREAM_WRITER defined */
  191. {

libavcodec/aacenc.c:150:5: 
148.     put_bits(&pb, 1, 0); //does not depend on core coder
149.     put_bits(&pb, 1, 0); //is not extension
150.     flush_put_bits(&pb);
         ^
151. }
152. 

libavcodec/put_bits.h:96:1: start of procedure flush_put_bits()
  94.  * Pads the end of the output stream with zeros.
  95.  */
  96. static inline void flush_put_bits(PutBitContext *s)
      ^
  97. {
  98. #ifdef ALT_BITSTREAM_WRITER

libavcodec/put_bits.h:102:5: 
  100. #else
  101. #ifndef BITSTREAM_WRITER_LE
  102.     s->bit_buf<<= s->bit_left;
           ^
  103. #endif
  104.     while (s->bit_left < 32) {

libavcodec/put_bits.h:104:12: Loop condition is true. Entering loop body
  102.     s->bit_buf<<= s->bit_left;
  103. #endif
  104.     while (s->bit_left < 32) {
                  ^
  105.         /* XXX: should test end of buffer */
  106. #ifdef BITSTREAM_WRITER_LE

libavcodec/put_bits.h:110:9: 
  108.         s->bit_buf>>=8;
  109. #else
  110.         *s->buf_ptr++=s->bit_buf >> 24;
               ^
  111.         s->bit_buf<<=8;
  112. #endif
