libavcodec/mpegvideo_enc.c:925: error: Null Dereference
  pointer `c` last assigned on line 908 could be null and is dereferenced at line 925, column 5.

libavcodec/mpegvideo_enc.c:906:1: start of procedure estimate_best_b_count()
904. }
905. 
906. static int estimate_best_b_count(MpegEncContext *s){
     ^
907.     AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
908.     AVCodecContext *c= avcodec_alloc_context();

libavcodec/mpegvideo_enc.c:907:5: Skipping avcodec_find_encoder(): empty list of specs
905. 
906. static int estimate_best_b_count(MpegEncContext *s){
907.     AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
         ^
908.     AVCodecContext *c= avcodec_alloc_context();
909.     AVFrame input[FF_MAX_B_FRAMES+2];

libavcodec/mpegvideo_enc.c:908:5: 
906. static int estimate_best_b_count(MpegEncContext *s){
907.     AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
908.     AVCodecContext *c= avcodec_alloc_context();
         ^
909.     AVFrame input[FF_MAX_B_FRAMES+2];
910.     const int scale= s->avctx->brd_scale;

libavcodec/options.c:449:1: start of procedure avcodec_alloc_context()
  447. }
  448. 
  449. AVCodecContext *avcodec_alloc_context(void){
       ^
  450.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  451. }

libavcodec/options.c:450:5: 
  448. 
  449. AVCodecContext *avcodec_alloc_context(void){
  450.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
           ^
  451. }
  452. 

libavcodec/options.c:435:1: start of procedure avcodec_alloc_context2()
    433. }
    434. 
    435. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
         ^
    436.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    437. 

libavcodec/options.c:436:5: 
    434. 
    435. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
    436.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
             ^
    437. 
    438.     if(avctx==NULL) return NULL;

libavutil/mem.c:43:1: start of procedure av_malloc()
      41.    linker will do it automatically */
      42. 
      43. void *av_malloc(unsigned int size)
          ^
      44. {
      45.     void *ptr = NULL;

libavutil/mem.c:45:5: 
      43. void *av_malloc(unsigned int size)
      44. {
      45.     void *ptr = NULL;
              ^
      46. #ifdef CONFIG_MEMALIGN_HACK
      47.     long diff;

libavutil/mem.c:51:8: Taking false branch
      49. 
      50.     /* let's disallow possible ambiguous cases */
      51.     if(size > (INT_MAX-16) )
                 ^
      52.         return NULL;
      53. 

libavutil/mem.c:62:5: Skipping posix_memalign(): method has no implementation
      60.     ((char*)ptr)[-1]= diff;
      61. #elif defined (HAVE_POSIX_MEMALIGN)
      62.     posix_memalign(&ptr,16,size);
              ^
      63. #elif defined (HAVE_MEMALIGN)
      64.     ptr = memalign(16,size);

libavutil/mem.c:94:5: 
      92.     ptr = malloc(size);
      93. #endif
      94.     return ptr;
              ^
      95. }
      96. 

libavutil/mem.c:95:1: return from a call to av_malloc
      93. #endif
      94.     return ptr;
      95. }
          ^
      96. 
      97. void *av_realloc(void *ptr, unsigned int size)

libavcodec/options.c:438:8: Taking true branch
    436.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    437. 
    438.     if(avctx==NULL) return NULL;
                ^
    439. 
    440.     avcodec_get_context_defaults2(avctx, codec_type);

libavcodec/options.c:438:21: 
    436.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    437. 
    438.     if(avctx==NULL) return NULL;
                             ^
    439. 
    440.     avcodec_get_context_defaults2(avctx, codec_type);

libavcodec/options.c:443:1: return from a call to avcodec_alloc_context2
    441. 
    442.     return avctx;
    443. }
         ^
    444. 
    445. void avcodec_get_context_defaults(AVCodecContext *s){

libavcodec/options.c:451:1: return from a call to avcodec_alloc_context
  449. AVCodecContext *avcodec_alloc_context(void){
  450.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  451. }
       ^
  452. 

libavcodec/mpegvideo_enc.c:910:5: 
908.     AVCodecContext *c= avcodec_alloc_context();
909.     AVFrame input[FF_MAX_B_FRAMES+2];
910.     const int scale= s->avctx->brd_scale;
         ^
911.     int i, j, out_size, p_lambda, b_lambda, lambda2;
912.     int outbuf_size= s->width * s->height; //FIXME

libavcodec/mpegvideo_enc.c:912:5: 
910.     const int scale= s->avctx->brd_scale;
911.     int i, j, out_size, p_lambda, b_lambda, lambda2;
912.     int outbuf_size= s->width * s->height; //FIXME
         ^
913.     uint8_t *outbuf= av_malloc(outbuf_size);
914.     int64_t best_rd= INT64_MAX;

libavcodec/mpegvideo_enc.c:913:5: 
911.     int i, j, out_size, p_lambda, b_lambda, lambda2;
912.     int outbuf_size= s->width * s->height; //FIXME
913.     uint8_t *outbuf= av_malloc(outbuf_size);
         ^
914.     int64_t best_rd= INT64_MAX;
915.     int best_b_count= -1;

libavutil/mem.c:43:1: start of procedure av_malloc()
  41.    linker will do it automatically */
  42. 
  43. void *av_malloc(unsigned int size)
      ^
  44. {
  45.     void *ptr = NULL;

libavutil/mem.c:45:5: 
  43. void *av_malloc(unsigned int size)
  44. {
  45.     void *ptr = NULL;
          ^
  46. #ifdef CONFIG_MEMALIGN_HACK
  47.     long diff;

libavutil/mem.c:51:8: Taking false branch
  49. 
  50.     /* let's disallow possible ambiguous cases */
  51.     if(size > (INT_MAX-16) )
             ^
  52.         return NULL;
  53. 

libavutil/mem.c:62:5: Skipping posix_memalign(): method has no implementation
  60.     ((char*)ptr)[-1]= diff;
  61. #elif defined (HAVE_POSIX_MEMALIGN)
  62.     posix_memalign(&ptr,16,size);
          ^
  63. #elif defined (HAVE_MEMALIGN)
  64.     ptr = memalign(16,size);

libavutil/mem.c:94:5: 
  92.     ptr = malloc(size);
  93. #endif
  94.     return ptr;
          ^
  95. }
  96. 

libavutil/mem.c:95:1: return from a call to av_malloc
  93. #endif
  94.     return ptr;
  95. }
      ^
  96. 
  97. void *av_realloc(void *ptr, unsigned int size)

libavcodec/mpegvideo_enc.c:914:5: 
912.     int outbuf_size= s->width * s->height; //FIXME
913.     uint8_t *outbuf= av_malloc(outbuf_size);
914.     int64_t best_rd= INT64_MAX;
         ^
915.     int best_b_count= -1;
916. 

libavcodec/mpegvideo_enc.c:915:5: 
913.     uint8_t *outbuf= av_malloc(outbuf_size);
914.     int64_t best_rd= INT64_MAX;
915.     int best_b_count= -1;
         ^
916. 
917.     assert(scale>=0 && scale <=3);

libavcodec/mpegvideo_enc.c:917:5: 
915.     int best_b_count= -1;
916. 
917.     assert(scale>=0 && scale <=3);
         ^
918. 
919. //    emms_c();

libavcodec/mpegvideo_enc.c:920:5: 
918. 
919. //    emms_c();
920.     p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality;
         ^
921.     b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
922.     if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else

libavcodec/mpegvideo_enc.c:921:5: 
919. //    emms_c();
920.     p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality;
921.     b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
         ^
922.     if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
923.     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;

libavcodec/mpegvideo_enc.c:922:9: Taking false branch
920.     p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality;
921.     b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
922.     if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
             ^
923.     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
924. 

libavcodec/mpegvideo_enc.c:923:5: 
921.     b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
922.     if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
923.     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
         ^
924. 
925.     c->width = s->width >> scale;

libavcodec/mpegvideo_enc.c:925:5: 
923.     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
924. 
925.     c->width = s->width >> scale;
         ^
926.     c->height= s->height>> scale;
927.     c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
