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

libavcodec/motion_est.c:1044:1: start of procedure ff_pre_estimate_p_frame_motion()
1042. }
1043. 
1044. int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
      ^
1045.                                     int mb_x, int mb_y)
1046. {

libavcodec/motion_est.c:1047:5: 
1045.                                     int mb_x, int mb_y)
1046. {
1047.     MotionEstContext * const c= &s->me;
          ^
1048.     int mx, my, dmin;
1049.     int P[10][2];

libavcodec/motion_est.c:1050:5: 
1048.     int mx, my, dmin;
1049.     int P[10][2];
1050.     const int shift= 1+s->quarter_sample;
          ^
1051.     const int xy= mb_x + mb_y*s->mb_stride;
1052.     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:1051:5: 
1049.     int P[10][2];
1050.     const int shift= 1+s->quarter_sample;
1051.     const int xy= mb_x + mb_y*s->mb_stride;
          ^
1052.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
1053. 

libavcodec/motion_est.c:1052:5: 
1050.     const int shift= 1+s->quarter_sample;
1051.     const int xy= mb_x + mb_y*s->mb_stride;
1052.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
          ^
1053. 
1054.     assert(s->quarter_sample==0 || s->quarter_sample==1);

libavcodec/motion_est.c:84:1: start of procedure init_ref()
  82. #define FLAG_DIRECT 4
  83. 
  84. 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){
      ^
  85.     const int offset[3]= {
  86.           y*c->  stride + x,

libavcodec/motion_est.c:85:5: 
  83. 
  84. 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){
  85.     const int offset[3]= {
          ^
  86.           y*c->  stride + x,
  87.         ((y*c->uvstride + x)>>1),

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

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

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

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

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

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

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

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

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

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

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

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

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

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