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

libavcodec/mpegvideo.c:1516:1: start of procedure ff_MPV_frame_end()
1514. /* generic function for encode/decode called after a
1515.  * frame has been coded/decoded. */
1516. void ff_MPV_frame_end(MpegEncContext *s)
      ^
1517. {
1518.     int i;

libavcodec/mpegvideo.c:1521:9: Taking false branch
1519.     /* redraw edges for the frame if decoding didn't complete */
1520.     // just to make sure that all data is rendered.
1521.     if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
              ^
1522.         ff_xvmc_field_end(s);
1523.    } else if ((s->error_count || s->encoding) &&

libavcodec/mpegvideo.c:1523:16: Taking false branch
1521.     if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
1522.         ff_xvmc_field_end(s);
1523.    } else if ((s->error_count || s->encoding) &&
                     ^
1524.               !s->avctx->hwaccel &&
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&

libavcodec/mpegvideo.c:1523:34: Taking true branch
1521.     if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
1522.         ff_xvmc_field_end(s);
1523.    } else if ((s->error_count || s->encoding) &&
                                       ^
1524.               !s->avctx->hwaccel &&
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&

libavcodec/mpegvideo.c:1524:16: Taking true branch
1522.         ff_xvmc_field_end(s);
1523.    } else if ((s->error_count || s->encoding) &&
1524.               !s->avctx->hwaccel &&
                     ^
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
1526.               s->unrestricted_mv &&

libavcodec/mpegvideo.c:1525:17: Taking true branch
1523.    } else if ((s->error_count || s->encoding) &&
1524.               !s->avctx->hwaccel &&
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
                      ^
1526.               s->unrestricted_mv &&
1527.               s->current_picture.f.reference &&

libavcodec/mpegvideo.c:1526:15: Taking true branch
1524.               !s->avctx->hwaccel &&
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
1526.               s->unrestricted_mv &&
                    ^
1527.               s->current_picture.f.reference &&
1528.               !s->intra_only &&

libavcodec/mpegvideo.c:1527:15: Taking true branch
1525.               !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
1526.               s->unrestricted_mv &&
1527.               s->current_picture.f.reference &&
                    ^
1528.               !s->intra_only &&
1529.               !(s->flags & CODEC_FLAG_EMU_EDGE)) {

libavcodec/mpegvideo.c:1528:16: Taking true branch
1526.               s->unrestricted_mv &&
1527.               s->current_picture.f.reference &&
1528.               !s->intra_only &&
                     ^
1529.               !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1530.        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);

libavcodec/mpegvideo.c:1529:17: Taking true branch
1527.               s->current_picture.f.reference &&
1528.               !s->intra_only &&
1529.               !(s->flags & CODEC_FLAG_EMU_EDGE)) {
                      ^
1530.        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1531.        int hshift = desc->log2_chroma_w;

libavcodec/mpegvideo.c:1530:8: 
1528.               !s->intra_only &&
1529.               !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1530.        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
             ^
1531.        int hshift = desc->log2_chroma_w;
1532.        int vshift = desc->log2_chroma_h;

libavutil/pixdesc.c:1199:1: start of procedure av_pix_fmt_desc_get()
  1197. }
  1198. 
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1201:9: Taking false branch
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1201:24: Taking true branch
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1202:9: 
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1202.         return NULL;
                ^
  1203.     return &av_pix_fmt_descriptors[pix_fmt];
  1204. }

libavutil/pixdesc.c:1204:1: return from a call to av_pix_fmt_desc_get
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];
  1204. }
        ^
  1205. 
  1206. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

libavcodec/mpegvideo.c:1531:8: 
1529.               !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1530.        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1531.        int hshift = desc->log2_chroma_w;
             ^
1532.        int vshift = desc->log2_chroma_h;
1533.        s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,

void ff_MPV_frame_end(MpegEncContext *s)
{
    int i;
    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
        ff_xvmc_field_end(s);
   } else if ((s->error_count || s->encoding) &&
              !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 hshift = desc->log2_chroma_w;
       int vshift = desc->log2_chroma_h;
       s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
                         s->h_edge_pos, s->v_edge_pos,
                         EDGE_WIDTH, EDGE_WIDTH,
                         EDGE_TOP | EDGE_BOTTOM);
       s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
                         s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
                         EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
                         EDGE_TOP | EDGE_BOTTOM);
       s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
                         s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
                         EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
                         EDGE_TOP | EDGE_BOTTOM);
    }
    emms_c();
    s->last_pict_type                 = s->pict_type;
    s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality;
    if (s->pict_type!= AV_PICTURE_TYPE_B) {
        s->last_non_b_pict_type = s->pict_type;
    }
#if 0
    for (i = 0; i < MAX_PICTURE_COUNT; i++) {
        if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) {
            s->picture[i] = s->current_picture;
            break;
        }
    }
    assert(i < MAX_PICTURE_COUNT);
#endif
    if (s->encoding) {
        for (i = 0; i < s->picture_count; i++) {
            if (s->picture[i].f.data[0] && !s->picture[i].f.reference
                 ) {
                free_frame_buffer(s, &s->picture[i]);
            }
        }
    }
#if 0
    memset(&s->last_picture,    0, sizeof(Picture));
    memset(&s->next_picture,    0, sizeof(Picture));
    memset(&s->current_picture, 0, sizeof(Picture));
#endif
    s->avctx->coded_frame = &s->current_picture_ptr->f;
    if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) {
        ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
    }
}
['void ff_MPV_frame_end(MpegEncContext *s)\n{\n    int i;\n    if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {\n        ff_xvmc_field_end(s);\n   } else if ((s->error_count || s->encoding) &&\n              !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 hshift = desc->log2_chroma_w;\n       int vshift = desc->log2_chroma_h;\n       s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,\n                         s->h_edge_pos, s->v_edge_pos,\n                         EDGE_WIDTH, EDGE_WIDTH,\n                         EDGE_TOP | EDGE_BOTTOM);\n       s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,\n                         s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,\n                         EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,\n                         EDGE_TOP | EDGE_BOTTOM);\n       s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,\n                         s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,\n                         EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,\n                         EDGE_TOP | EDGE_BOTTOM);\n    }\n    emms_c();\n    s->last_pict_type                 = s->pict_type;\n    s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality;\n    if (s->pict_type!= AV_PICTURE_TYPE_B) {\n        s->last_non_b_pict_type = s->pict_type;\n    }\n#if 0\n    for (i = 0; i < MAX_PICTURE_COUNT; i++) {\n        if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) {\n            s->picture[i] = s->current_picture;\n            break;\n        }\n    }\n    assert(i < MAX_PICTURE_COUNT);\n#endif\n    if (s->encoding) {\n        for (i = 0; i < s->picture_count; i++) {\n            if (s->picture[i].f.data[0] && !s->picture[i].f.reference\n                 ) {\n                free_frame_buffer(s, &s->picture[i]);\n            }\n        }\n    }\n#if 0\n    memset(&s->last_picture,    0, sizeof(Picture));\n    memset(&s->next_picture,    0, sizeof(Picture));\n    memset(&s->current_picture, 0, sizeof(Picture));\n#endif\n    s->avctx->coded_frame = &s->current_picture_ptr->f;\n    if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) {\n        ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);\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}']