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

libavcodec/aacenc.c:164:1: start of procedure put_audio_specific_config()
162.  * @see 1.6.2.1 "Syntax - AudioSpecificConfig"
163.  */
164. static void put_audio_specific_config(AVCodecContext *avctx)
     ^
165. {
166.     PutBitContext pb;

libavcodec/aacenc.c:167:5: 
165. {
166.     PutBitContext pb;
167.     AACEncContext *s = avctx->priv_data;
         ^
168. 
169.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);

libavcodec/aacenc.c:169:5: 
167.     AACEncContext *s = avctx->priv_data;
168. 
169.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
         ^
170.     put_bits(&pb, 5, 2); //object type - AAC-LC
171.     put_bits(&pb, 4, s->samplerate_index); //sample rate index

libavcodec/put_bits.h:52:1: start of procedure init_put_bits()
  50.  * @param buffer_size the size in bytes of buffer
  51.  */
  52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
      ^
  53. {
  54.     if(buffer_size < 0) {

libavcodec/put_bits.h:54:8: Taking true branch
  52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
  53. {
  54.     if(buffer_size < 0) {
             ^
  55.         buffer_size = 0;
  56.         buffer = NULL;

libavcodec/put_bits.h:55:9: 
  53. {
  54.     if(buffer_size < 0) {
  55.         buffer_size = 0;
              ^
  56.         buffer = NULL;
  57.     }

libavcodec/put_bits.h:56:9: 
  54.     if(buffer_size < 0) {
  55.         buffer_size = 0;
  56.         buffer = NULL;
              ^
  57.     }
  58. 

libavcodec/put_bits.h:59:5: 
  57.     }
  58. 
  59.     s->size_in_bits= 8*buffer_size;
          ^
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;

libavcodec/put_bits.h:60:5: 
  58. 
  59.     s->size_in_bits= 8*buffer_size;
  60.     s->buf = buffer;
          ^
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;

libavcodec/put_bits.h:61:5: 
  59.     s->size_in_bits= 8*buffer_size;
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;
          ^
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;

libavcodec/put_bits.h:62:5: 
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;
          ^
  63.     s->bit_left=32;
  64.     s->bit_buf=0;

libavcodec/put_bits.h:63:5: 
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;
          ^
  64.     s->bit_buf=0;
  65. }

libavcodec/put_bits.h:64:5: 
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;
  64.     s->bit_buf=0;
          ^
  65. }
  66. 

libavcodec/put_bits.h:65:1: return from a call to init_put_bits
  63.     s->bit_left=32;
  64.     s->bit_buf=0;
  65. }
      ^
  66. 
  67. /**

libavcodec/aacenc.c:170:5: 
168. 
169.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
170.     put_bits(&pb, 5, 2); //object type - AAC-LC
         ^
171.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
172.     put_bits(&pb, 4, s->channels);

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:171:5: 
169.     init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
170.     put_bits(&pb, 5, 2); //object type - AAC-LC
171.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
         ^
172.     put_bits(&pb, 4, s->channels);
173.     //GASpecificConfig

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:172:5: 
170.     put_bits(&pb, 5, 2); //object type - AAC-LC
171.     put_bits(&pb, 4, s->samplerate_index); //sample rate index
172.     put_bits(&pb, 4, s->channels);
         ^
173.     //GASpecificConfig
174.     put_bits(&pb, 1, 0); //frame length - 1024 samples

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:174:5: 
172.     put_bits(&pb, 4, s->channels);
173.     //GASpecificConfig
174.     put_bits(&pb, 1, 0); //frame length - 1024 samples
         ^
175.     put_bits(&pb, 1, 0); //does not depend on core coder
176.     put_bits(&pb, 1, 0); //is not extension

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:175:5: 
173.     //GASpecificConfig
174.     put_bits(&pb, 1, 0); //frame length - 1024 samples
175.     put_bits(&pb, 1, 0); //does not depend on core coder
         ^
176.     put_bits(&pb, 1, 0); //is not extension
177. 

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:176:5: 
174.     put_bits(&pb, 1, 0); //frame length - 1024 samples
175.     put_bits(&pb, 1, 0); //does not depend on core coder
176.     put_bits(&pb, 1, 0); //is not extension
         ^
177. 
178.     //Explicitly Mark SBR absent

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:179:5: 
177. 
178.     //Explicitly Mark SBR absent
179.     put_bits(&pb, 11, 0x2b7); //sync extension
         ^
180.     put_bits(&pb, 5,  AOT_SBR);
181.     put_bits(&pb, 1,  0);

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking true branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:150:9: 
  148. #else
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
               ^
  151.         bit_left-=n;
  152.     } else {

libavcodec/put_bits.h:151:9: 
  149.     if (n < bit_left) {
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;
               ^
  152.     } else {
  153.         bit_buf<<=bit_left;

libavcodec/put_bits.h:162:5: 
  160. #endif
  161. 
  162.     s->bit_buf = bit_buf;
           ^
  163.     s->bit_left = bit_left;
  164. }

libavcodec/put_bits.h:163:5: 
  161. 
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
           ^
  164. }
  165. 

libavcodec/put_bits.h:164:1: return from a call to put_bits
  162.     s->bit_buf = bit_buf;
  163.     s->bit_left = bit_left;
  164. }
       ^
  165. 
  166. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/aacenc.c:180:5: 
178.     //Explicitly Mark SBR absent
179.     put_bits(&pb, 11, 0x2b7); //sync extension
180.     put_bits(&pb, 5,  AOT_SBR);
         ^
181.     put_bits(&pb, 1,  0);
182.     flush_put_bits(&pb);

libavcodec/put_bits.h:128:1: start of procedure put_bits()
  126.  * Use put_bits32 to write 32 bits.
  127.  */
  128. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  129. {
  130.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131.     int bit_left;
  132. 
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     /* XXX: optimize */

libavcodec/put_bits.h:149:9: Taking false branch
  147.     bit_left-=n;
  148. #else
  149.     if (n < bit_left) {
               ^
  150.         bit_buf = (bit_buf<<n) | value;
  151.         bit_left-=n;

libavcodec/put_bits.h:153:9: 
  151.         bit_left-=n;
  152.     } else {
  153.         bit_buf<<=bit_left;
               ^
  154.         bit_buf |= value >> (n - bit_left);
  155.         AV_WB32(s->buf_ptr, bit_buf);

libavcodec/put_bits.h:154:9: 
  152.     } else {
  153.         bit_buf<<=bit_left;
  154.         bit_buf |= value >> (n - bit_left);
               ^
  155.         AV_WB32(s->buf_ptr, bit_buf);
  156.         s->buf_ptr+=4;

libavcodec/put_bits.h:155:9: 
  153.         bit_buf<<=bit_left;
  154.         bit_buf |= value >> (n - bit_left);
  155.         AV_WB32(s->buf_ptr, bit_buf);
               ^
  156.         s->buf_ptr+=4;
  157.         bit_left+=32 - n;
