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

libavcodec/mpegvideo_enc.c:1108:1: start of procedure estimate_best_b_count()
1106. }
1107. 
1108. static int estimate_best_b_count(MpegEncContext *s)
      ^
1109. {
1110.     AVCodec *codec    = avcodec_find_encoder(s->avctx->codec_id);

libavcodec/mpegvideo_enc.c:1110:5: Skipping avcodec_find_encoder(): empty list of specs
1108. static int estimate_best_b_count(MpegEncContext *s)
1109. {
1110.     AVCodec *codec    = avcodec_find_encoder(s->avctx->codec_id);
          ^
1111.     AVCodecContext *c = avcodec_alloc_context3(NULL);
1112.     AVFrame input[FF_MAX_B_FRAMES + 2];

libavcodec/mpegvideo_enc.c:1111:5: 
1109. {
1110.     AVCodec *codec    = avcodec_find_encoder(s->avctx->codec_id);
1111.     AVCodecContext *c = avcodec_alloc_context3(NULL);
          ^
1112.     AVFrame input[FF_MAX_B_FRAMES + 2];
1113.     const int scale = s->avctx->brd_scale;

libavcodec/options.c:602:1: start of procedure avcodec_alloc_context3()
  600. }
  601. 
  602. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
       ^
  603.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
  604. 

libavcodec/options.c:603:5: 
  601. 
  602. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
  603.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
           ^
  604. 
  605.     if(avctx==NULL) return NULL;

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.    linker will do it automatically. */
    63. 
    64. void *av_malloc(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:8: Taking false branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if(size > (INT_MAX-32) )
               ^
    73.         return NULL;
    74. 

libavutil/mem.c:83:9: Taking false branch
    81.     ((char*)ptr)[-1]= diff;
    82. #elif HAVE_POSIX_MEMALIGN
    83.     if (posix_memalign(&ptr,32,size))
                ^
    84.         ptr = NULL;
    85. #elif HAVE_MEMALIGN

libavutil/mem.c:114:5: 
    112.     ptr = malloc(size);
    113. #endif
    114.     return ptr;
             ^
    115. }
    116. 

libavutil/mem.c:115:1: return from a call to av_malloc
    113. #endif
    114.     return ptr;
    115. }
         ^
    116. 
    117. void *av_realloc(void *ptr, size_t size)

libavcodec/options.c:605:8: Taking true branch
  603.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
  604. 
  605.     if(avctx==NULL) return NULL;
              ^
  606. 
  607.     if(avcodec_get_context_defaults3(avctx, codec) < 0){

libavcodec/options.c:605:21: 
  603.     AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
  604. 
  605.     if(avctx==NULL) return NULL;
                           ^
  606. 
  607.     if(avcodec_get_context_defaults3(avctx, codec) < 0){

libavcodec/options.c:613:1: return from a call to avcodec_alloc_context3
  611. 
  612.     return avctx;
  613. }
       ^
  614. 
  615. #if FF_API_ALLOC_CONTEXT

libavcodec/mpegvideo_enc.c:1113:5: 
1111.     AVCodecContext *c = avcodec_alloc_context3(NULL);
1112.     AVFrame input[FF_MAX_B_FRAMES + 2];
1113.     const int scale = s->avctx->brd_scale;
          ^
1114.     int i, j, out_size, p_lambda, b_lambda, lambda2;
1115.     int outbuf_size  = s->width * s->height; // FIXME

libavcodec/mpegvideo_enc.c:1115:5: 
1113.     const int scale = s->avctx->brd_scale;
1114.     int i, j, out_size, p_lambda, b_lambda, lambda2;
1115.     int outbuf_size  = s->width * s->height; // FIXME
          ^
1116.     uint8_t *outbuf  = av_malloc(outbuf_size);
1117.     int64_t best_rd  = INT64_MAX;

libavcodec/mpegvideo_enc.c:1116:5: 
1114.     int i, j, out_size, p_lambda, b_lambda, lambda2;
1115.     int outbuf_size  = s->width * s->height; // FIXME
1116.     uint8_t *outbuf  = av_malloc(outbuf_size);
          ^
1117.     int64_t best_rd  = INT64_MAX;
1118.     int best_b_count = -1;

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(size_t size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(size_t size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-32) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:83:9: Taking false branch
  81.     ((char*)ptr)[-1]= diff;
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,32,size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_MEMALIGN

libavutil/mem.c:114:5: 
  112.     ptr = malloc(size);
  113. #endif
  114.     return ptr;
           ^
  115. }
  116. 

libavutil/mem.c:115:1: return from a call to av_malloc
  113. #endif
  114.     return ptr;
  115. }
       ^
  116. 
  117. void *av_realloc(void *ptr, size_t size)

libavcodec/mpegvideo_enc.c:1117:5: 
1115.     int outbuf_size  = s->width * s->height; // FIXME
1116.     uint8_t *outbuf  = av_malloc(outbuf_size);
1117.     int64_t best_rd  = INT64_MAX;
          ^
1118.     int best_b_count = -1;
1119. 

libavcodec/mpegvideo_enc.c:1118:5: 
1116.     uint8_t *outbuf  = av_malloc(outbuf_size);
1117.     int64_t best_rd  = INT64_MAX;
1118.     int best_b_count = -1;
          ^
1119. 
1120.     assert(scale >= 0 && scale <= 3);

libavcodec/mpegvideo_enc.c:1120:5: 
1118.     int best_b_count = -1;
1119. 
1120.     assert(scale >= 0 && scale <= 3);
          ^
1121. 
1122.     //emms_c();

libavcodec/mpegvideo_enc.c:1124:5: 
1122.     //emms_c();
1123.     //s->next_picture_ptr->quality;
1124.     p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P];
          ^
1125.     //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
1126.     b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B];

libavcodec/mpegvideo_enc.c:1126:5: 
1124.     p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P];
1125.     //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
1126.     b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B];
          ^
1127.     if (!b_lambda) // FIXME we should do this somewhere else
1128.         b_lambda = p_lambda;

libavcodec/mpegvideo_enc.c:1127:10: Taking false branch
1125.     //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
1126.     b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B];
1127.     if (!b_lambda) // FIXME we should do this somewhere else
               ^
1128.         b_lambda = p_lambda;
1129.     lambda2  = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >>

libavcodec/mpegvideo_enc.c:1129:5: 
1127.     if (!b_lambda) // FIXME we should do this somewhere else
1128.         b_lambda = p_lambda;
1129.     lambda2  = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >>
          ^
1130.                FF_LAMBDA_SHIFT;
1131. 

libavcodec/mpegvideo_enc.c:1132:5: 
1130.                FF_LAMBDA_SHIFT;
1131. 
1132.     c->width        = s->width  >> scale;
          ^
1133.     c->height       = s->height >> scale;
1134.     c->flags        = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR |
