avconv.c:1815: error: Null Dereference
  pointer `ist` last assigned on line 1813 could be null and is dereferenced at line 1815, column 34.

avconv.c:1810:1: start of procedure init_output_stream_streamcopy()
1808. }
1809. 
1810. static int init_output_stream_streamcopy(OutputStream *ost)
      ^
1811. {
1812.     OutputFile *of = output_files[ost->file_index];

avconv.c:1812:5: 
1810. static int init_output_stream_streamcopy(OutputStream *ost)
1811. {
1812.     OutputFile *of = output_files[ost->file_index];
          ^
1813.     InputStream *ist = get_input_stream(ost);
1814.     AVCodecParameters *par_dst = ost->st->codecpar;

avconv.c:1813:5: 
1811. {
1812.     OutputFile *of = output_files[ost->file_index];
1813.     InputStream *ist = get_input_stream(ost);
          ^
1814.     AVCodecParameters *par_dst = ost->st->codecpar;
1815.     AVCodecParameters *par_src = ist->st->codecpar;

avconv.c:1701:1: start of procedure get_input_stream()
  1699. }
  1700. 
  1701. static InputStream *get_input_stream(OutputStream *ost)
        ^
  1702. {
  1703.     if (ost->source_index >= 0)

avconv.c:1703:9: Taking false branch
  1701. static InputStream *get_input_stream(OutputStream *ost)
  1702. {
  1703.     if (ost->source_index >= 0)
                ^
  1704.         return input_streams[ost->source_index];
  1705. 

avconv.c:1706:9: Taking true branch
  1704.         return input_streams[ost->source_index];
  1705. 
  1706.     if (ost->filter) {
                ^
  1707.         FilterGraph *fg = ost->filter->graph;
  1708.         int i;

avconv.c:1707:9: 
  1705. 
  1706.     if (ost->filter) {
  1707.         FilterGraph *fg = ost->filter->graph;
                ^
  1708.         int i;
  1709. 

avconv.c:1710:14: 
  1708.         int i;
  1709. 
  1710.         for (i = 0; i < fg->nb_inputs; i++)
                     ^
  1711.             if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
  1712.                 return fg->inputs[i]->ist;

avconv.c:1710:21: Loop condition is true. Entering loop body
  1708.         int i;
  1709. 
  1710.         for (i = 0; i < fg->nb_inputs; i++)
                            ^
  1711.             if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
  1712.                 return fg->inputs[i]->ist;

avconv.c:1711:17: Taking false branch
  1709. 
  1710.         for (i = 0; i < fg->nb_inputs; i++)
  1711.             if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
                        ^
  1712.                 return fg->inputs[i]->ist;
  1713.     }

avconv.c:1710:40: 
  1708.         int i;
  1709. 
  1710.         for (i = 0; i < fg->nb_inputs; i++)
                                               ^
  1711.             if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
  1712.                 return fg->inputs[i]->ist;

avconv.c:1710:21: Loop condition is false. Leaving loop
  1708.         int i;
  1709. 
  1710.         for (i = 0; i < fg->nb_inputs; i++)
                            ^
  1711.             if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
  1712.                 return fg->inputs[i]->ist;

avconv.c:1715:5: 
  1713.     }
  1714. 
  1715.     return NULL;
            ^
  1716. }
  1717. 

avconv.c:1716:1: return from a call to get_input_stream
  1714. 
  1715.     return NULL;
  1716. }
        ^
  1717. 
  1718. /* open the muxer when all the streams are initialized */

avconv.c:1814:5: 
1812.     OutputFile *of = output_files[ost->file_index];
1813.     InputStream *ist = get_input_stream(ost);
1814.     AVCodecParameters *par_dst = ost->st->codecpar;
          ^
1815.     AVCodecParameters *par_src = ist->st->codecpar;
1816.     AVRational sar;

avconv.c:1815:5: 
1813.     InputStream *ist = get_input_stream(ost);
1814.     AVCodecParameters *par_dst = ost->st->codecpar;
1815.     AVCodecParameters *par_src = ist->st->codecpar;
          ^
1816.     AVRational sar;
1817.     uint32_t codec_tag = par_dst->codec_tag;

static int init_output_stream_streamcopy(OutputStream *ost)
{
    OutputFile *of = output_files[ost->file_index];
    InputStream *ist = get_input_stream(ost);
    AVCodecParameters *par_dst = ost->st->codecpar;
    AVCodecParameters *par_src = ist->st->codecpar;
    AVRational sar;
    uint32_t codec_tag = par_dst->codec_tag;
    int i, ret;
    if (!codec_tag) {
        if (!of->ctx->oformat->codec_tag ||
             av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_src->codec_id ||
             av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0)
            codec_tag = par_src->codec_tag;
    }
    ret = avcodec_parameters_copy(par_dst, par_src);
    if (ret < 0)
        return ret;
    par_dst->codec_tag = codec_tag;
    ost->st->disposition = ist->st->disposition;
    ost->st->time_base = ist->st->time_base;
    if (ist->st->nb_side_data) {
        ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
                                              sizeof(*ist->st->side_data));
        if (!ost->st->side_data)
            return AVERROR(ENOMEM);
        for (i = 0; i < ist->st->nb_side_data; i++) {
            const AVPacketSideData *sd_src = &ist->st->side_data[i];
            AVPacketSideData *sd_dst = &ost->st->side_data[i];
            sd_dst->data = av_malloc(sd_src->size);
            if (!sd_dst->data)
                return AVERROR(ENOMEM);
            memcpy(sd_dst->data, sd_src->data, sd_src->size);
            sd_dst->size = sd_src->size;
            sd_dst->type = sd_src->type;
            ost->st->nb_side_data++;
        }
    }
    ost->parser = av_parser_init(par_dst->codec_id);
    ost->parser_avctx = avcodec_alloc_context3(NULL);
    if (!ost->parser_avctx)
        return AVERROR(ENOMEM);
    if (par_dst->codec_type == AVMEDIA_TYPE_VIDEO) {
        if (ost->frame_aspect_ratio)
            sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255);
        else if (ist->st->sample_aspect_ratio.num)
            sar = ist->st->sample_aspect_ratio;
        else
            sar = par_src->sample_aspect_ratio;
        ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar;
    }
    return 0;
}
['static int init_output_stream_streamcopy(OutputStream *ost)\n{\n    OutputFile *of = output_files[ost->file_index];\n    InputStream *ist = get_input_stream(ost);\n    AVCodecParameters *par_dst = ost->st->codecpar;\n    AVCodecParameters *par_src = ist->st->codecpar;\n    AVRational sar;\n    uint32_t codec_tag = par_dst->codec_tag;\n    int i, ret;\n    if (!codec_tag) {\n        if (!of->ctx->oformat->codec_tag ||\n             av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_src->codec_id ||\n             av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0)\n            codec_tag = par_src->codec_tag;\n    }\n    ret = avcodec_parameters_copy(par_dst, par_src);\n    if (ret < 0)\n        return ret;\n    par_dst->codec_tag = codec_tag;\n    ost->st->disposition = ist->st->disposition;\n    ost->st->time_base = ist->st->time_base;\n    if (ist->st->nb_side_data) {\n        ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,\n                                              sizeof(*ist->st->side_data));\n        if (!ost->st->side_data)\n            return AVERROR(ENOMEM);\n        for (i = 0; i < ist->st->nb_side_data; i++) {\n            const AVPacketSideData *sd_src = &ist->st->side_data[i];\n            AVPacketSideData *sd_dst = &ost->st->side_data[i];\n            sd_dst->data = av_malloc(sd_src->size);\n            if (!sd_dst->data)\n                return AVERROR(ENOMEM);\n            memcpy(sd_dst->data, sd_src->data, sd_src->size);\n            sd_dst->size = sd_src->size;\n            sd_dst->type = sd_src->type;\n            ost->st->nb_side_data++;\n        }\n    }\n    ost->parser = av_parser_init(par_dst->codec_id);\n    ost->parser_avctx = avcodec_alloc_context3(NULL);\n    if (!ost->parser_avctx)\n        return AVERROR(ENOMEM);\n    if (par_dst->codec_type == AVMEDIA_TYPE_VIDEO) {\n        if (ost->frame_aspect_ratio)\n            sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255);\n        else if (ist->st->sample_aspect_ratio.num)\n            sar = ist->st->sample_aspect_ratio;\n        else\n            sar = par_src->sample_aspect_ratio;\n        ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar;\n    }\n    return 0;\n}', 'static InputStream *get_input_stream(OutputStream *ost)\n{\n    if (ost->source_index >= 0)\n        return input_streams[ost->source_index];\n    if (ost->filter) {\n        FilterGraph *fg = ost->filter->graph;\n        int i;\n        for (i = 0; i < fg->nb_inputs; i++)\n            if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)\n                return fg->inputs[i]->ist;\n    }\n    return NULL;\n}']