libavcodec/mpegvideo.c:656: error: Null Dereference
  pointer `s->mb_index2xy` last assigned on line 650 could be null and is dereferenced at line 656, column 5.

libavcodec/mpegvideo.c:622:1: start of procedure init_context_frame()
620.  * Initialize and allocates MpegEncContext fields dependent on the resolution.
621.  */
622. static int init_context_frame(MpegEncContext *s)
     ^
623. {
624.     int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;

libavcodec/mpegvideo.c:626:5: 
624.     int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
625. 
626.     s->mb_width   = (s->width + 15) / 16;
         ^
627.     s->mb_stride  = s->mb_width + 1;
628.     s->b8_stride  = s->mb_width * 2 + 1;

libavcodec/mpegvideo.c:627:5: 
625. 
626.     s->mb_width   = (s->width + 15) / 16;
627.     s->mb_stride  = s->mb_width + 1;
         ^
628.     s->b8_stride  = s->mb_width * 2 + 1;
629.     mb_array_size = s->mb_height * s->mb_stride;

libavcodec/mpegvideo.c:628:5: 
626.     s->mb_width   = (s->width + 15) / 16;
627.     s->mb_stride  = s->mb_width + 1;
628.     s->b8_stride  = s->mb_width * 2 + 1;
         ^
629.     mb_array_size = s->mb_height * s->mb_stride;
630.     mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;

libavcodec/mpegvideo.c:629:5: 
627.     s->mb_stride  = s->mb_width + 1;
628.     s->b8_stride  = s->mb_width * 2 + 1;
629.     mb_array_size = s->mb_height * s->mb_stride;
         ^
630.     mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
631. 

libavcodec/mpegvideo.c:630:5: 
628.     s->b8_stride  = s->mb_width * 2 + 1;
629.     mb_array_size = s->mb_height * s->mb_stride;
630.     mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
         ^
631. 
632.     /* set default edge pos, will be overridden

libavcodec/mpegvideo.c:634:5: 
632.     /* set default edge pos, will be overridden
633.      * in decode_header if needed */
634.     s->h_edge_pos = s->mb_width * 16;
         ^
635.     s->v_edge_pos = s->mb_height * 16;
636. 

libavcodec/mpegvideo.c:635:5: 
633.      * in decode_header if needed */
634.     s->h_edge_pos = s->mb_width * 16;
635.     s->v_edge_pos = s->mb_height * 16;
         ^
636. 
637.     s->mb_num     = s->mb_width * s->mb_height;

libavcodec/mpegvideo.c:637:5: 
635.     s->v_edge_pos = s->mb_height * 16;
636. 
637.     s->mb_num     = s->mb_width * s->mb_height;
         ^
638. 
639.     s->block_wrap[0] =

libavcodec/mpegvideo.c:639:5: 
637.     s->mb_num     = s->mb_width * s->mb_height;
638. 
639.     s->block_wrap[0] =
         ^
640.     s->block_wrap[1] =
641.     s->block_wrap[2] =

libavcodec/mpegvideo.c:643:5: 
641.     s->block_wrap[2] =
642.     s->block_wrap[3] = s->b8_stride;
643.     s->block_wrap[4] =
         ^
644.     s->block_wrap[5] = s->mb_stride;
645. 

libavcodec/mpegvideo.c:646:5: 
644.     s->block_wrap[5] = s->mb_stride;
645. 
646.     y_size  = s->b8_stride * (2 * s->mb_height + 1);
         ^
647.     c_size  = s->mb_stride * (s->mb_height + 1);
648.     yc_size = y_size + 2   * c_size;

libavcodec/mpegvideo.c:647:5: 
645. 
646.     y_size  = s->b8_stride * (2 * s->mb_height + 1);
647.     c_size  = s->mb_stride * (s->mb_height + 1);
         ^
648.     yc_size = y_size + 2   * c_size;
649. 

libavcodec/mpegvideo.c:648:5: 
646.     y_size  = s->b8_stride * (2 * s->mb_height + 1);
647.     c_size  = s->mb_stride * (s->mb_height + 1);
648.     yc_size = y_size + 2   * c_size;
         ^
649. 
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),

libavcodec/mpegvideo.c:650:5: 
648.     yc_size = y_size + 2   * c_size;
649. 
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
         ^
651.                       fail); // error resilience code looks cleaner with this
652.     for (y = 0; y < s->mb_height; y++)

libavutil/mem.c:188:1: start of procedure av_mallocz()
  186. }
  187. 
  188. void *av_mallocz(size_t size)
       ^
  189. {
  190.     void *ptr = av_malloc(size);

libavutil/mem.c:190:5: 
  188. void *av_mallocz(size_t size)
  189. {
  190.     void *ptr = av_malloc(size);
           ^
  191.     if (ptr)
  192.         memset(ptr, 0, size);

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

libavutil/mem.c:64:5: 
    62. void *av_malloc(size_t size)
    63. {
    64.     void *ptr = NULL;
            ^
    65. 
    66.     /* let's disallow possibly ambiguous cases */

libavutil/mem.c:67:9: Taking true branch
    65. 
    66.     /* let's disallow possibly ambiguous cases */
    67.     if (size > (INT_MAX - 32) || !size)
                ^
    68.         return NULL;
    69. 

libavutil/mem.c:68:9: 
    66.     /* let's disallow possibly ambiguous cases */
    67.     if (size > (INT_MAX - 32) || !size)
    68.         return NULL;
                ^
    69. 
    70. #if HAVE_POSIX_MEMALIGN

libavutil/mem.c:105:1: return from a call to av_malloc
    103. #endif
    104.     return ptr;
    105. }
         ^
    106. 
    107. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:191:9: Taking false branch
  189. {
  190.     void *ptr = av_malloc(size);
  191.     if (ptr)
               ^
  192.         memset(ptr, 0, size);
  193.     return ptr;

libavutil/mem.c:193:5: 
  191.     if (ptr)
  192.         memset(ptr, 0, size);
  193.     return ptr;
           ^
  194. }
  195. 

libavutil/mem.c:194:1: return from a call to av_mallocz
  192.         memset(ptr, 0, size);
  193.     return ptr;
  194. }
       ^
  195. 
  196. char *av_strdup(const char *s)

libavcodec/mpegvideo.c:650:5: Taking true branch
648.     yc_size = y_size + 2   * c_size;
649. 
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
         ^
651.                       fail); // error resilience code looks cleaner with this
652.     for (y = 0; y < s->mb_height; y++)

libavcodec/mpegvideo.c:650:5: Taking false branch
648.     yc_size = y_size + 2   * c_size;
649. 
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
         ^
651.                       fail); // error resilience code looks cleaner with this
652.     for (y = 0; y < s->mb_height; y++)

libavcodec/mpegvideo.c:652:10: 
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
651.                       fail); // error resilience code looks cleaner with this
652.     for (y = 0; y < s->mb_height; y++)
              ^
653.         for (x = 0; x < s->mb_width; x++)
654.             s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;

libavcodec/mpegvideo.c:652:17: Loop condition is false. Leaving loop
650.     FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
651.                       fail); // error resilience code looks cleaner with this
652.     for (y = 0; y < s->mb_height; y++)
                     ^
653.         for (x = 0; x < s->mb_width; x++)
654.             s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;

libavcodec/mpegvideo.c:656:5: 
654.             s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
655. 
656.     s->mb_index2xy[s->mb_height * s->mb_width] =
         ^
657.         (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
658. 
