ffmpeg.c:3315: error: Null Dereference
  pointer `st` last assigned on line 3310 could be null and is dereferenced at line 3315, column 35.

ffmpeg.c:3304:1: start of procedure new_audio_stream()
3302. }
3303. 
3304. static void new_audio_stream(AVFormatContext *oc)
      ^
3305. {
3306.     AVStream *st;

ffmpeg.c:3310:5: 
3308.     enum CodecID codec_id;
3309. 
3310.     st = av_new_stream(oc, oc->nb_streams);
          ^
3311.     if (!st) {
3312.         fprintf(stderr, "Could not alloc stream\n");

libavformat/utils.c:2462:1: start of procedure av_new_stream()
  2460. }
  2461. 
  2462. AVStream *av_new_stream(AVFormatContext *s, int id)
        ^
  2463. {
  2464.     AVStream *st;

libavformat/utils.c:2467:9: Taking true branch
  2465.     int i;
  2466. 
  2467.     if (s->nb_streams >= MAX_STREAMS)
                ^
  2468.         return NULL;
  2469. 

libavformat/utils.c:2468:9: 
  2466. 
  2467.     if (s->nb_streams >= MAX_STREAMS)
  2468.         return NULL;
                ^
  2469. 
  2470.     st = av_mallocz(sizeof(AVStream));

libavformat/utils.c:2502:1: return from a call to av_new_stream
  2500.     s->streams[s->nb_streams++] = st;
  2501.     return st;
  2502. }
        ^
  2503. 
  2504. AVProgram *av_new_program(AVFormatContext *ac, int id)

ffmpeg.c:3311:10: Taking true branch
3309. 
3310.     st = av_new_stream(oc, oc->nb_streams);
3311.     if (!st) {
               ^
3312.         fprintf(stderr, "Could not alloc stream\n");
3313.         av_exit(1);

ffmpeg.c:3312:9: 
3310.     st = av_new_stream(oc, oc->nb_streams);
3311.     if (!st) {
3312.         fprintf(stderr, "Could not alloc stream\n");
              ^
3313.         av_exit(1);
3314.     }

ffmpeg.c:3313:9: Skipping av_exit(): empty list of specs
3311.     if (!st) {
3312.         fprintf(stderr, "Could not alloc stream\n");
3313.         av_exit(1);
              ^
3314.     }
3315.     avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);

ffmpeg.c:3315:5: 
3313.         av_exit(1);
3314.     }
3315.     avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);
          ^
3316. 
3317.     bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;

static void new_audio_stream(AVFormatContext *oc)
{
    AVStream *st;
    AVCodecContext *audio_enc;
    enum CodecID codec_id;
    st = av_new_stream(oc, oc->nb_streams);
    if (!st) {
        fprintf(stderr, "Could not alloc stream\n");
        av_exit(1);
    }
    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);
    bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
    audio_bitstream_filters= NULL;
    avcodec_thread_init(st->codec, thread_count);
    audio_enc = st->codec;
    audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
    if(audio_codec_tag)
        audio_enc->codec_tag= audio_codec_tag;
    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
        audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
        avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
    }
    if (audio_stream_copy) {
        st->stream_copy = 1;
        audio_enc->channels = audio_channels;
        audio_enc->sample_rate = audio_sample_rate;
    } else {
        AVCodec *codec;
        set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
        if (audio_codec_name) {
            codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1);
            codec = avcodec_find_encoder_by_name(audio_codec_name);
            output_codecs[nb_ocodecs] = codec;
        } else {
            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);
            codec = avcodec_find_encoder(codec_id);
        }
        audio_enc->codec_id = codec_id;
        if (audio_qscale > QSCALE_NONE) {
            audio_enc->flags |= CODEC_FLAG_QSCALE;
            audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
        }
        audio_enc->channels = audio_channels;
        audio_enc->sample_fmt = audio_sample_fmt;
        audio_enc->sample_rate = audio_sample_rate;
        audio_enc->channel_layout = channel_layout;
        if (avcodec_channel_layout_num_channels(channel_layout) != audio_channels)
            audio_enc->channel_layout = 0;
        choose_sample_fmt(st, codec);
        choose_sample_rate(st, codec);
    }
    nb_ocodecs++;
    audio_enc->time_base= (AVRational){1, audio_sample_rate};
    if (audio_language) {
        av_metadata_set2(&st->metadata, "language", audio_language, 0);
        av_freep(&audio_language);
    }
    audio_disable = 0;
    av_freep(&audio_codec_name);
    audio_stream_copy = 0;
}
['static void new_audio_stream(AVFormatContext *oc)\n{\n    AVStream *st;\n    AVCodecContext *audio_enc;\n    enum CodecID codec_id;\n    st = av_new_stream(oc, oc->nb_streams);\n    if (!st) {\n        fprintf(stderr, "Could not alloc stream\\n");\n        av_exit(1);\n    }\n    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);\n    bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;\n    audio_bitstream_filters= NULL;\n    avcodec_thread_init(st->codec, thread_count);\n    audio_enc = st->codec;\n    audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;\n    if(audio_codec_tag)\n        audio_enc->codec_tag= audio_codec_tag;\n    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {\n        audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;\n        avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;\n    }\n    if (audio_stream_copy) {\n        st->stream_copy = 1;\n        audio_enc->channels = audio_channels;\n        audio_enc->sample_rate = audio_sample_rate;\n    } else {\n        AVCodec *codec;\n        set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);\n        if (audio_codec_name) {\n            codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1);\n            codec = avcodec_find_encoder_by_name(audio_codec_name);\n            output_codecs[nb_ocodecs] = codec;\n        } else {\n            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);\n            codec = avcodec_find_encoder(codec_id);\n        }\n        audio_enc->codec_id = codec_id;\n        if (audio_qscale > QSCALE_NONE) {\n            audio_enc->flags |= CODEC_FLAG_QSCALE;\n            audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;\n        }\n        audio_enc->channels = audio_channels;\n        audio_enc->sample_fmt = audio_sample_fmt;\n        audio_enc->sample_rate = audio_sample_rate;\n        audio_enc->channel_layout = channel_layout;\n        if (avcodec_channel_layout_num_channels(channel_layout) != audio_channels)\n            audio_enc->channel_layout = 0;\n        choose_sample_fmt(st, codec);\n        choose_sample_rate(st, codec);\n    }\n    nb_ocodecs++;\n    audio_enc->time_base= (AVRational){1, audio_sample_rate};\n    if (audio_language) {\n        av_metadata_set2(&st->metadata, "language", audio_language, 0);\n        av_freep(&audio_language);\n    }\n    audio_disable = 0;\n    av_freep(&audio_codec_name);\n    audio_stream_copy = 0;\n}', 'AVStream *av_new_stream(AVFormatContext *s, int id)\n{\n    AVStream *st;\n    int i;\n    if (s->nb_streams >= MAX_STREAMS)\n        return NULL;\n    st = av_mallocz(sizeof(AVStream));\n    if (!st)\n        return NULL;\n    st->codec= avcodec_alloc_context();\n    if (s->iformat) {\n        st->codec->bit_rate = 0;\n    }\n    st->index = s->nb_streams;\n    st->id = id;\n    st->start_time = AV_NOPTS_VALUE;\n    st->duration = AV_NOPTS_VALUE;\n    st->cur_dts = 0;\n    st->first_dts = AV_NOPTS_VALUE;\n    st->probe_packets = MAX_PROBE_PACKETS;\n    av_set_pts_info(st, 33, 1, 90000);\n    st->last_IP_pts = AV_NOPTS_VALUE;\n    for(i=0; i<MAX_REORDER_DELAY+1; i++)\n        st->pts_buffer[i]= AV_NOPTS_VALUE;\n    st->reference_dts = AV_NOPTS_VALUE;\n    st->sample_aspect_ratio = (AVRational){0,1};\n    s->streams[s->nb_streams++] = st;\n    return st;\n}']