libavcodec/mpegvideo.c:2397: error: Null Dereference
  pointer `desc` last assigned on line 2395 could be null and is dereferenced at line 2397, column 22.

libavcodec/mpegvideo.c:2382:1: start of procedure ff_draw_horiz_band()
2380.  * @param h is the normal height, this will be reduced automatically if needed for the last row
2381.  */
2382. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
      ^
2383.     const int field_pic= s->picture_structure != PICT_FRAME;
2384.     if(field_pic){

libavcodec/mpegvideo.c:2383:26: Condition is true
2381.  */
2382. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
2383.     const int field_pic= s->picture_structure != PICT_FRAME;
                               ^
2384.     if(field_pic){
2385.         h <<= 1;

libavcodec/mpegvideo.c:2383:5: 
2381.  */
2382. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
2383.     const int field_pic= s->picture_structure != PICT_FRAME;
          ^
2384.     if(field_pic){
2385.         h <<= 1;

libavcodec/mpegvideo.c:2384:8: Taking true branch
2382. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
2383.     const int field_pic= s->picture_structure != PICT_FRAME;
2384.     if(field_pic){
             ^
2385.         h <<= 1;
2386.         y <<= 1;

libavcodec/mpegvideo.c:2385:9: 
2383.     const int field_pic= s->picture_structure != PICT_FRAME;
2384.     if(field_pic){
2385.         h <<= 1;
              ^
2386.         y <<= 1;
2387.     }

libavcodec/mpegvideo.c:2386:9: 
2384.     if(field_pic){
2385.         h <<= 1;
2386.         y <<= 1;
              ^
2387.     }
2388. 

libavcodec/mpegvideo.c:2389:10: Taking true branch
2387.     }
2388. 
2389.     if (!s->avctx->hwaccel
               ^
2390.        && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
2391.        && s->unrestricted_mv

libavcodec/mpegvideo.c:2390:13: Taking true branch
2388. 
2389.     if (!s->avctx->hwaccel
2390.        && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
                  ^
2391.        && s->unrestricted_mv
2392.        && s->current_picture.f.reference

libavcodec/mpegvideo.c:2391:11: Taking true branch
2389.     if (!s->avctx->hwaccel
2390.        && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
2391.        && s->unrestricted_mv
                ^
2392.        && s->current_picture.f.reference
2393.        && !s->intra_only

libavcodec/mpegvideo.c:2392:11: Taking true branch
2390.        && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
2391.        && s->unrestricted_mv
2392.        && s->current_picture.f.reference
                ^
2393.        && !s->intra_only
2394.        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {

libavcodec/mpegvideo.c:2393:12: Taking true branch
2391.        && s->unrestricted_mv
2392.        && s->current_picture.f.reference
2393.        && !s->intra_only
                 ^
2394.        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
2395.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);

libavcodec/mpegvideo.c:2394:13: Taking true branch
2392.        && s->current_picture.f.reference
2393.        && !s->intra_only
2394.        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
                  ^
2395.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
2396.         int sides = 0, edge_h;

libavcodec/mpegvideo.c:2395:9: 
2393.        && !s->intra_only
2394.        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
2395.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
              ^
2396.         int sides = 0, edge_h;
2397.         int hshift = desc->log2_chroma_w;

libavutil/pixdesc.c:1440:1: start of procedure av_pix_fmt_desc_get()
  1438. }
  1439. 
  1440. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1441. {
  1442.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1442:9: Taking false branch
  1440. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1441. {
  1442.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1443.         return NULL;
  1444.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1442:24: Taking true branch
  1440. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1441. {
  1442.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1443.         return NULL;
  1444.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1443:9: 
  1441. {
  1442.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1443.         return NULL;
                ^
  1444.     return &av_pix_fmt_descriptors[pix_fmt];
  1445. }

libavutil/pixdesc.c:1445:1: return from a call to av_pix_fmt_desc_get
  1443.         return NULL;
  1444.     return &av_pix_fmt_descriptors[pix_fmt];
  1445. }
        ^
  1446. 
  1447. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

libavcodec/mpegvideo.c:2396:9: 
2394.        && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
2395.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
2396.         int sides = 0, edge_h;
              ^
2397.         int hshift = desc->log2_chroma_w;
2398.         int vshift = desc->log2_chroma_h;

libavcodec/mpegvideo.c:2397:9: 
2395.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
2396.         int sides = 0, edge_h;
2397.         int hshift = desc->log2_chroma_w;
              ^
2398.         int vshift = desc->log2_chroma_h;
2399.         if (y==0) sides |= EDGE_TOP;

void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
    const int field_pic= s->picture_structure != PICT_FRAME;
    if(field_pic){
        h <<= 1;
        y <<= 1;
    }
    if (!s->avctx->hwaccel
       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
       && s->unrestricted_mv
       && s->current_picture.f.reference
       && !s->intra_only
       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
        int sides = 0, edge_h;
        int hshift = desc->log2_chroma_w;
        int vshift = desc->log2_chroma_h;
        if (y==0) sides |= EDGE_TOP;
        if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;
        edge_h= FFMIN(h, s->v_edge_pos - y);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[0] +  y         *s->linesize,
                          s->linesize,           s->h_edge_pos,         edge_h,
                          EDGE_WIDTH,            EDGE_WIDTH,            sides);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[1] + (y>>vshift)*s->uvlinesize,
                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,
                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);
        s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize,
                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,
                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);
    }
    h= FFMIN(h, s->avctx->height - y);
    if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
    if (s->avctx->draw_horiz_band) {
        AVFrame *src;
        int offset[AV_NUM_DATA_POINTERS];
        int i;
        if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
            src = &s->current_picture_ptr->f;
        else if(s->last_picture_ptr)
            src = &s->last_picture_ptr->f;
        else
            return;
        if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
            for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
                offset[i] = 0;
        }else{
            offset[0]= y * s->linesize;
            offset[1]=
            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
            for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
                offset[i] = 0;
        }
        emms_c();
        s->avctx->draw_horiz_band(s->avctx, src, offset,
                                  y, s->picture_structure, h);
    }
}
['void ff_draw_horiz_band(MpegEncContext *s, int y, int h){\n    const int field_pic= s->picture_structure != PICT_FRAME;\n    if(field_pic){\n        h <<= 1;\n        y <<= 1;\n    }\n    if (!s->avctx->hwaccel\n       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)\n       && s->unrestricted_mv\n       && s->current_picture.f.reference\n       && !s->intra_only\n       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {\n        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);\n        int sides = 0, edge_h;\n        int hshift = desc->log2_chroma_w;\n        int vshift = desc->log2_chroma_h;\n        if (y==0) sides |= EDGE_TOP;\n        if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM;\n        edge_h= FFMIN(h, s->v_edge_pos - y);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[0] +  y         *s->linesize,\n                          s->linesize,           s->h_edge_pos,         edge_h,\n                          EDGE_WIDTH,            EDGE_WIDTH,            sides);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[1] + (y>>vshift)*s->uvlinesize,\n                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,\n                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);\n        s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize,\n                          s->uvlinesize,         s->h_edge_pos>>hshift, edge_h>>vshift,\n                          EDGE_WIDTH>>hshift,    EDGE_WIDTH>>vshift,    sides);\n    }\n    h= FFMIN(h, s->avctx->height - y);\n    if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;\n    if (s->avctx->draw_horiz_band) {\n        AVFrame *src;\n        int offset[AV_NUM_DATA_POINTERS];\n        int i;\n        if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))\n            src = &s->current_picture_ptr->f;\n        else if(s->last_picture_ptr)\n            src = &s->last_picture_ptr->f;\n        else\n            return;\n        if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){\n            for (i = 0; i < AV_NUM_DATA_POINTERS; i++)\n                offset[i] = 0;\n        }else{\n            offset[0]= y * s->linesize;\n            offset[1]=\n            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;\n            for (i = 3; i < AV_NUM_DATA_POINTERS; i++)\n                offset[i] = 0;\n        }\n        emms_c();\n        s->avctx->draw_horiz_band(s->avctx, src, offset,\n                                  y, s->picture_structure, h);\n    }\n}', 'const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)\n{\n    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)\n        return NULL;\n    return &av_pix_fmt_descriptors[pix_fmt];\n}']