libavcodec/motion_est.c:1058: error: Null Dereference
  pointer `null` is dereferenced by call to `init_ref()` at line 1058, column 5.

libavcodec/motion_est.c:1050:1: start of procedure ff_pre_estimate_p_frame_motion()
1048. }
1049. 
1050. int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
      ^
1051.                                     int mb_x, int mb_y)
1052. {

libavcodec/motion_est.c:1053:5: 
1051.                                     int mb_x, int mb_y)
1052. {
1053.     MotionEstContext * const c= &s->me;
          ^
1054.     int mx, my, dmin;
1055.     int P[10][2];

libavcodec/motion_est.c:1056:5: 
1054.     int mx, my, dmin;
1055.     int P[10][2];
1056.     const int shift= 1+s->quarter_sample;
          ^
1057.     const int xy= mb_x + mb_y*s->mb_stride;
1058.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);

libavcodec/motion_est.c:1057:5: 
1055.     int P[10][2];
1056.     const int shift= 1+s->quarter_sample;
1057.     const int xy= mb_x + mb_y*s->mb_stride;
          ^
1058.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
1059. 

libavcodec/motion_est.c:1058:5: 
1056.     const int shift= 1+s->quarter_sample;
1057.     const int xy= mb_x + mb_y*s->mb_stride;
1058.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
          ^
1059. 
1060.     assert(s->quarter_sample==0 || s->quarter_sample==1);

libavcodec/motion_est.c:86:1: start of procedure init_ref()
  84. #define FLAG_DIRECT 4
  85. 
  86. static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){
      ^
  87.     const int offset[3]= {
  88.           y*c->  stride + x,

libavcodec/motion_est.c:87:5: 
  85. 
  86. static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){
  87.     const int offset[3]= {
          ^
  88.           y*c->  stride + x,
  89.         ((y*c->uvstride + x)>>1),

libavcodec/motion_est.c:93:9: 
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
              ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:93:14: Loop condition is true. Entering loop body
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
                   ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:94:9: 
  92.     int i;
  93.     for(i=0; i<3; i++){
  94.         c->src[0][i]= src [i] + offset[i];
              ^
  95.         c->ref[0][i]= ref [i] + offset[i];
  96.     }

libavcodec/motion_est.c:95:9: 
  93.     for(i=0; i<3; i++){
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];
              ^
  96.     }
  97.     if(ref_index){

libavcodec/motion_est.c:93:19: 
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
                        ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:93:14: Loop condition is true. Entering loop body
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
                   ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:94:9: 
  92.     int i;
  93.     for(i=0; i<3; i++){
  94.         c->src[0][i]= src [i] + offset[i];
              ^
  95.         c->ref[0][i]= ref [i] + offset[i];
  96.     }

libavcodec/motion_est.c:95:9: 
  93.     for(i=0; i<3; i++){
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];
              ^
  96.     }
  97.     if(ref_index){

libavcodec/motion_est.c:93:19: 
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
                        ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:93:14: Loop condition is false. Leaving loop
  91.     };
  92.     int i;
  93.     for(i=0; i<3; i++){
                   ^
  94.         c->src[0][i]= src [i] + offset[i];
  95.         c->ref[0][i]= ref [i] + offset[i];

libavcodec/motion_est.c:97:8: Taking true branch
  95.         c->ref[0][i]= ref [i] + offset[i];
  96.     }
  97.     if(ref_index){
             ^
  98.         for(i=0; i<3; i++){
  99.             c->ref[ref_index][i]= ref2[i] + offset[i];

libavcodec/motion_est.c:98:13: 
   96.     }
   97.     if(ref_index){
   98.         for(i=0; i<3; i++){
                   ^
   99.             c->ref[ref_index][i]= ref2[i] + offset[i];
  100.         }

libavcodec/motion_est.c:98:18: Loop condition is true. Entering loop body
   96.     }
   97.     if(ref_index){
   98.         for(i=0; i<3; i++){
                        ^
   99.             c->ref[ref_index][i]= ref2[i] + offset[i];
  100.         }

libavcodec/motion_est.c:99:13: 
   97.     if(ref_index){
   98.         for(i=0; i<3; i++){
   99.             c->ref[ref_index][i]= ref2[i] + offset[i];
                   ^
  100.         }
  101.     }
