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

libavcodec/mpegvideo_enc.c:933:1: start of procedure estimate_best_b_count()
931. }
932. 
933. static int estimate_best_b_count(MpegEncContext *s){
     ^
934.     AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
935.     AVCodecContext *c= avcodec_alloc_context();

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

libavcodec/mpegvideo_enc.c:935:5: 
933. static int estimate_best_b_count(MpegEncContext *s){
934.     AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
935.     AVCodecContext *c= avcodec_alloc_context();
         ^
936.     AVFrame input[FF_MAX_B_FRAMES+2];
937.     const int scale= s->avctx->brd_scale;

libavcodec/utils.c:788:1: start of procedure avcodec_alloc_context()
  786. }
  787. 
  788. AVCodecContext *avcodec_alloc_context(void){
       ^
  789.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  790. }

libavcodec/utils.c:789:5: 
  787. 
  788. AVCodecContext *avcodec_alloc_context(void){
  789.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
           ^
  790. }
  791. 

libavcodec/utils.c:774:1: start of procedure avcodec_alloc_context2()
    772. }
    773. 
    774. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
         ^
    775.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    776. 

libavcodec/utils.c:775:5: 
    773. 
    774. AVCodecContext *avcodec_alloc_context2(enum CodecType codec_type){
    775.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
             ^
    776. 
    777.     if(avctx==NULL) return NULL;

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

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

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
      59.     ((char*)ptr)[-1]= diff;
      60. #elif defined (HAVE_MEMALIGN)
      61.     ptr = memalign(16,size);
              ^
      62.     /* Why 64?
      63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
      89.     ptr = malloc(size);
      90. #endif
      91.     return ptr;
              ^
      92. }
      93. 

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

libavcodec/utils.c:777:8: Taking true branch
    775.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    776. 
    777.     if(avctx==NULL) return NULL;
                ^
    778. 
    779.     avcodec_get_context_defaults2(avctx, codec_type);

libavcodec/utils.c:777:21: 
    775.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
    776. 
    777.     if(avctx==NULL) return NULL;
                             ^
    778. 
    779.     avcodec_get_context_defaults2(avctx, codec_type);

libavcodec/utils.c:782:1: return from a call to avcodec_alloc_context2
    780. 
    781.     return avctx;
    782. }
         ^
    783. 
    784. void avcodec_get_context_defaults(AVCodecContext *s){

libavcodec/utils.c:790:1: return from a call to avcodec_alloc_context
  788. AVCodecContext *avcodec_alloc_context(void){
  789.     return avcodec_alloc_context2(CODEC_TYPE_UNKNOWN);
  790. }
       ^
  791. 
  792. void avcodec_get_frame_defaults(AVFrame *pic){

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

libavcodec/mpegvideo_enc.c:939:5: 
937.     const int scale= s->avctx->brd_scale;
938.     int i, j, out_size, p_lambda, b_lambda, lambda2;
939.     int outbuf_size= s->width * s->height; //FIXME
         ^
940.     uint8_t *outbuf= av_malloc(outbuf_size);
941.     int64_t best_rd= INT64_MAX;

libavcodec/mpegvideo_enc.c:940:5: 
938.     int i, j, out_size, p_lambda, b_lambda, lambda2;
939.     int outbuf_size= s->width * s->height; //FIXME
940.     uint8_t *outbuf= av_malloc(outbuf_size);
         ^
941.     int64_t best_rd= INT64_MAX;
942.     int best_b_count= -1;

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

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

libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
  59.     ((char*)ptr)[-1]= diff;
  60. #elif defined (HAVE_MEMALIGN)
  61.     ptr = memalign(16,size);
          ^
  62.     /* Why 64?
  63.        Indeed, we should align it:

libavutil/mem.c:91:5: 
  89.     ptr = malloc(size);
  90. #endif
  91.     return ptr;
          ^
  92. }
  93. 

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

libavcodec/mpegvideo_enc.c:941:5: 
939.     int outbuf_size= s->width * s->height; //FIXME
940.     uint8_t *outbuf= av_malloc(outbuf_size);
941.     int64_t best_rd= INT64_MAX;
         ^
942.     int best_b_count= -1;
943. 

libavcodec/mpegvideo_enc.c:942:5: 
940.     uint8_t *outbuf= av_malloc(outbuf_size);
941.     int64_t best_rd= INT64_MAX;
942.     int best_b_count= -1;
         ^
943. 
944.     assert(scale>=0 && scale <=3);

libavcodec/mpegvideo_enc.c:944:5: 
942.     int best_b_count= -1;
943. 
944.     assert(scale>=0 && scale <=3);
         ^
945. 
946. //    emms_c();

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

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

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

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

libavcodec/mpegvideo_enc.c:952:5: 
950.     lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
951. 
952.     c->width = s->width >> scale;
         ^
953.     c->height= s->height>> scale;
954.     c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
