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

libavcodec/motion_est.c:874:1: start of procedure ff_estimate_p_frame_motion()
872. }
873. 
874. void ff_estimate_p_frame_motion(MpegEncContext * s,
     ^
875.                                 int mb_x, int mb_y)
876. {

libavcodec/motion_est.c:877:5: 
875.                                 int mb_x, int mb_y)
876. {
877.     MotionEstContext * const c= &s->me;
         ^
878.     uint8_t *pix, *ppix;
879.     int sum, mx = 0, my = 0, dmin = 0;

libavcodec/motion_est.c:879:5: 
877.     MotionEstContext * const c= &s->me;
878.     uint8_t *pix, *ppix;
879.     int sum, mx = 0, my = 0, dmin = 0;
         ^
880.     int varc;            ///< the variance of the block (sum of squared (p[y][x]-average))
881.     int vard;            ///< sum of squared differences with the estimated motion vector

libavcodec/motion_est.c:883:5: 
881.     int vard;            ///< sum of squared differences with the estimated motion vector
882.     int P[10][2];
883.     const int shift= 1+s->quarter_sample;
         ^
884.     int mb_type=0;
885.     Picture * const pic= &s->current_picture;

libavcodec/motion_est.c:884:5: 
882.     int P[10][2];
883.     const int shift= 1+s->quarter_sample;
884.     int mb_type=0;
         ^
885.     Picture * const pic= &s->current_picture;
886. 

libavcodec/motion_est.c:885:5: 
883.     const int shift= 1+s->quarter_sample;
884.     int mb_type=0;
885.     Picture * const pic= &s->current_picture;
         ^
886. 
887.     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:887:5: 
885.     Picture * const pic= &s->current_picture;
886. 
887.     init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0);
         ^
888. 
889.     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.     }
