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

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

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

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

libavcodec/options.c:456:1: start of procedure avcodec_alloc_context()
  454. }
  455. 
  456. AVCodecContext *avcodec_alloc_context(void){
       ^
  457.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  458. }

libavcodec/options.c:457:5: 
  455. 
  456. AVCodecContext *avcodec_alloc_context(void){
  457.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
           ^
  458. }
  459. 

libavcodec/options.c:442:1: start of procedure avcodec_alloc_context2()
    440. }
    441. 
    442. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
         ^
    443.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    444. 

libavcodec/options.c:443:5: 
    441. 
    442. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
    443.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
             ^
    444. 
    445.     if(avctx==NULL) return NULL;

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 false branch
      53. 
      54.     /* let's disallow possible ambiguous cases */
      55.     if(size > (INT_MAX-16) )
                 ^
      56.         return NULL;
      57. 

libavutil/mem.c:66:9: Taking false branch
      64.     ((char*)ptr)[-1]= diff;
      65. #elif HAVE_POSIX_MEMALIGN
      66.     if (posix_memalign(&ptr,16,size))
                  ^
      67.         ptr = NULL;
      68. #elif HAVE_MEMALIGN

libavutil/mem.c:99:5: 
       97.     ptr = malloc(size);
       98. #endif
       99.     return ptr;
               ^
      100. }
      101. 

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)

libavcodec/options.c:445:8: Taking true branch
    443.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    444. 
    445.     if(avctx==NULL) return NULL;
                ^
    446. 
    447.     avcodec_get_context_defaults2(avctx, codec_type);

libavcodec/options.c:445:21: 
    443.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    444. 
    445.     if(avctx==NULL) return NULL;
                             ^
    446. 
    447.     avcodec_get_context_defaults2(avctx, codec_type);

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

libavcodec/options.c:458:1: return from a call to avcodec_alloc_context
  456. AVCodecContext *avcodec_alloc_context(void){
  457.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  458. }
       ^
  459. 

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

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

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

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 false branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:66:9: Taking false branch
  64.     ((char*)ptr)[-1]= diff;
  65. #elif HAVE_POSIX_MEMALIGN
  66.     if (posix_memalign(&ptr,16,size))
              ^
  67.         ptr = NULL;
  68. #elif HAVE_MEMALIGN

libavutil/mem.c:99:5: 
   97.     ptr = malloc(size);
   98. #endif
   99.     return ptr;
           ^
  100. }
  101. 

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)

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

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

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

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

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

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

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

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