avtools/avconv.c:1645: error: Null Dereference
  pointer `desc` last assigned on line 1641 could be null and is dereferenced at line 1645, column 15.

avtools/avconv.c:1634:1: start of procedure get_format()
1632. }
1633. 
1634. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
      ^
1635. {
1636.     InputStream *ist = s->opaque;

avtools/avconv.c:1636:5: 
1634. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
1635. {
1636.     InputStream *ist = s->opaque;
          ^
1637.     const enum AVPixelFormat *p;
1638.     int ret;

avtools/avconv.c:1640:10: 
1638.     int ret;
1639. 
1640.     for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
               ^
1641.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1642.         const AVCodecHWConfig  *config = NULL;

avtools/avconv.c:1640:24: Loop condition is true. Entering loop body
1638.     int ret;
1639. 
1640.     for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
                             ^
1641.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1642.         const AVCodecHWConfig  *config = NULL;

avtools/avconv.c:1641:9: 
1639. 
1640.     for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
1641.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
              ^
1642.         const AVCodecHWConfig  *config = NULL;
1643.         int i;

libavutil/pixdesc.c:1901:1: start of procedure av_pix_fmt_desc_get()
  1899. }
  1900. 
  1901. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1902. {
  1903.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1903:9: Taking false branch
  1901. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1902. {
  1903.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1904.         return NULL;
  1905.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1903:24: Taking true branch
  1901. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1902. {
  1903.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1904.         return NULL;
  1905.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1904:9: 
  1902. {
  1903.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1904.         return NULL;
                ^
  1905.     return &av_pix_fmt_descriptors[pix_fmt];
  1906. }

libavutil/pixdesc.c:1906:1: return from a call to av_pix_fmt_desc_get
  1904.         return NULL;
  1905.     return &av_pix_fmt_descriptors[pix_fmt];
  1906. }
        ^
  1907. 
  1908. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

avtools/avconv.c:1642:9: 
1640.     for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
1641.         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1642.         const AVCodecHWConfig  *config = NULL;
              ^
1643.         int i;
1644. 

avtools/avconv.c:1645:15: 
1643.         int i;
1644. 
1645.         if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
                    ^
1646.             break;
1647. 

static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
{
    InputStream *ist = s->opaque;
    const enum AVPixelFormat *p;
    int ret;
    for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
        const AVCodecHWConfig  *config = NULL;
        int i;
        if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
            break;
        if (ist->hwaccel_id == HWACCEL_GENERIC ||
            ist->hwaccel_id == HWACCEL_AUTO) {
            for (i = 0;; i++) {
                config = avcodec_get_hw_config(s->codec, i);
                if (!config)
                    break;
                if (!(config->methods &
                      AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))
                    continue;
                if (config->pix_fmt == *p)
                    break;
            }
        }
        if (config) {
            if (config->device_type != ist->hwaccel_device_type) {
                continue;
            }
            ret = hwaccel_decode_init(s);
            if (ret < 0) {
                if (ist->hwaccel_id == HWACCEL_GENERIC) {
                    av_log(NULL, AV_LOG_FATAL,
                           "%s hwaccel requested for input stream #%d:%d, "
                           "but cannot be initialized.\n",
                           av_hwdevice_get_type_name(config->device_type),
                           ist->file_index, ist->st->index);
                    return AV_PIX_FMT_NONE;
                }
                continue;
            }
        } else {
            const HWAccel *hwaccel = NULL;
            int i;
            for (i = 0; hwaccels[i].name; i++) {
                if (hwaccels[i].pix_fmt == *p) {
                    hwaccel = &hwaccels[i];
                    break;
                }
            }
            if (!hwaccel) {
                continue;
            }
            if (hwaccel->id != ist->hwaccel_id) {
                continue;
            }
            ret = hwaccel->init(s);
            if (ret < 0) {
                av_log(NULL, AV_LOG_FATAL,
                       "%s hwaccel requested for input stream #%d:%d, "
                       "but cannot be initialized.\n", hwaccel->name,
                       ist->file_index, ist->st->index);
                return AV_PIX_FMT_NONE;
            }
        }
        if (ist->hw_frames_ctx) {
            s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);
            if (!s->hw_frames_ctx)
                return AV_PIX_FMT_NONE;
        }
        ist->hwaccel_pix_fmt = *p;
        break;
    }
    return *p;
}
['static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)\n{\n    InputStream *ist = s->opaque;\n    const enum AVPixelFormat *p;\n    int ret;\n    for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {\n        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);\n        const AVCodecHWConfig  *config = NULL;\n        int i;\n        if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))\n            break;\n        if (ist->hwaccel_id == HWACCEL_GENERIC ||\n            ist->hwaccel_id == HWACCEL_AUTO) {\n            for (i = 0;; i++) {\n                config = avcodec_get_hw_config(s->codec, i);\n                if (!config)\n                    break;\n                if (!(config->methods &\n                      AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX))\n                    continue;\n                if (config->pix_fmt == *p)\n                    break;\n            }\n        }\n        if (config) {\n            if (config->device_type != ist->hwaccel_device_type) {\n                continue;\n            }\n            ret = hwaccel_decode_init(s);\n            if (ret < 0) {\n                if (ist->hwaccel_id == HWACCEL_GENERIC) {\n                    av_log(NULL, AV_LOG_FATAL,\n                           "%s hwaccel requested for input stream #%d:%d, "\n                           "but cannot be initialized.\\n",\n                           av_hwdevice_get_type_name(config->device_type),\n                           ist->file_index, ist->st->index);\n                    return AV_PIX_FMT_NONE;\n                }\n                continue;\n            }\n        } else {\n            const HWAccel *hwaccel = NULL;\n            int i;\n            for (i = 0; hwaccels[i].name; i++) {\n                if (hwaccels[i].pix_fmt == *p) {\n                    hwaccel = &hwaccels[i];\n                    break;\n                }\n            }\n            if (!hwaccel) {\n                continue;\n            }\n            if (hwaccel->id != ist->hwaccel_id) {\n                continue;\n            }\n            ret = hwaccel->init(s);\n            if (ret < 0) {\n                av_log(NULL, AV_LOG_FATAL,\n                       "%s hwaccel requested for input stream #%d:%d, "\n                       "but cannot be initialized.\\n", hwaccel->name,\n                       ist->file_index, ist->st->index);\n                return AV_PIX_FMT_NONE;\n            }\n        }\n        if (ist->hw_frames_ctx) {\n            s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);\n            if (!s->hw_frames_ctx)\n                return AV_PIX_FMT_NONE;\n        }\n        ist->hwaccel_pix_fmt = *p;\n        break;\n    }\n    return *p;\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}']