ffmpeg.c:3589: error: Null Dereference
  pointer `st` last assigned on line 3583 could be null and is dereferenced at line 3589, column 16.

ffmpeg.c:3576:1: start of procedure new_data_stream()
3574. }
3575. 
3576. static void new_data_stream(AVFormatContext *oc, int file_idx)
      ^
3577. {
3578.     AVStream *st;

ffmpeg.c:3580:5: 
3578.     AVStream *st;
3579.     AVOutputStream *ost;
3580.     AVCodec *codec=NULL;
          ^
3581.     AVCodecContext *data_enc;
3582. 

ffmpeg.c:3583:28: Condition is true
3581.     AVCodecContext *data_enc;
3582. 
3583.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
                                 ^
3584.     if (!st) {
3585.         fprintf(stderr, "Could not alloc stream\n");

ffmpeg.c:3583:5: 
3581.     AVCodecContext *data_enc;
3582. 
3583.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
          ^
3584.     if (!st) {
3585.         fprintf(stderr, "Could not alloc stream\n");

libavformat/utils.c:2585:1: start of procedure av_new_stream()
  2583. }
  2584. 
  2585. AVStream *av_new_stream(AVFormatContext *s, int id)
        ^
  2586. {
  2587.     AVStream *st;

libavformat/utils.c:2591:9: Taking true branch
  2589.     AVStream **streams;
  2590. 
  2591.     if (s->nb_streams >= INT_MAX/sizeof(*streams))
                ^
  2592.         return NULL;
  2593.     streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));

libavformat/utils.c:2592:9: 
  2590. 
  2591.     if (s->nb_streams >= INT_MAX/sizeof(*streams))
  2592.         return NULL;
                ^
  2593.     streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
  2594.     if (!streams)

libavformat/utils.c:2634:1: return from a call to av_new_stream
  2632.     s->streams[s->nb_streams++] = st;
  2633.     return st;
  2634. }
        ^
  2635. 
  2636. AVProgram *av_new_program(AVFormatContext *ac, int id)

ffmpeg.c:3584:10: Taking true branch
3582. 
3583.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3584.     if (!st) {
               ^
3585.         fprintf(stderr, "Could not alloc stream\n");
3586.         ffmpeg_exit(1);

ffmpeg.c:3585:9: 
3583.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3584.     if (!st) {
3585.         fprintf(stderr, "Could not alloc stream\n");
              ^
3586.         ffmpeg_exit(1);
3587.     }

ffmpeg.c:3586:9: Skipping ffmpeg_exit(): empty list of specs
3584.     if (!st) {
3585.         fprintf(stderr, "Could not alloc stream\n");
3586.         ffmpeg_exit(1);
              ^
3587.     }
3588.     ost = new_output_stream(oc, file_idx);

ffmpeg.c:3588:5: Skipping new_output_stream(): empty list of specs
3586.         ffmpeg_exit(1);
3587.     }
3588.     ost = new_output_stream(oc, file_idx);
          ^
3589.     data_enc = st->codec;
3590.     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);

ffmpeg.c:3589:5: 
3587.     }
3588.     ost = new_output_stream(oc, file_idx);
3589.     data_enc = st->codec;
          ^
3590.     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
3591.     if (!data_stream_copy) {

static void new_data_stream(AVFormatContext *oc, int file_idx)
{
    AVStream *st;
    AVOutputStream *ost;
    AVCodec *codec=NULL;
    AVCodecContext *data_enc;
    st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
    if (!st) {
        fprintf(stderr, "Could not alloc stream\n");
        ffmpeg_exit(1);
    }
    ost = new_output_stream(oc, file_idx);
    data_enc = st->codec;
    output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
    if (!data_stream_copy) {
        fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");
        ffmpeg_exit(1);
    }
    avcodec_get_context_defaults3(st->codec, codec);
    data_enc->codec_type = AVMEDIA_TYPE_DATA;
    if (data_codec_tag)
        data_enc->codec_tag= data_codec_tag;
    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
        data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
        avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER;
    }
    if (data_stream_copy) {
        st->stream_copy = 1;
    }
    data_disable = 0;
    av_freep(&data_codec_name);
    data_stream_copy = 0;
}
['static void new_data_stream(AVFormatContext *oc, int file_idx)\n{\n    AVStream *st;\n    AVOutputStream *ost;\n    AVCodec *codec=NULL;\n    AVCodecContext *data_enc;\n    st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);\n    if (!st) {\n        fprintf(stderr, "Could not alloc stream\\n");\n        ffmpeg_exit(1);\n    }\n    ost = new_output_stream(oc, file_idx);\n    data_enc = st->codec;\n    output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);\n    if (!data_stream_copy) {\n        fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\\n");\n        ffmpeg_exit(1);\n    }\n    avcodec_get_context_defaults3(st->codec, codec);\n    data_enc->codec_type = AVMEDIA_TYPE_DATA;\n    if (data_codec_tag)\n        data_enc->codec_tag= data_codec_tag;\n    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {\n        data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;\n        avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER;\n    }\n    if (data_stream_copy) {\n        st->stream_copy = 1;\n    }\n    data_disable = 0;\n    av_freep(&data_codec_name);\n    data_stream_copy = 0;\n}', 'AVStream *av_new_stream(AVFormatContext *s, int id)\n{\n    AVStream *st;\n    int i;\n    AVStream **streams;\n    if (s->nb_streams >= INT_MAX/sizeof(*streams))\n        return NULL;\n    streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));\n    if (!streams)\n        return NULL;\n    s->streams = streams;\n    st = av_mallocz(sizeof(AVStream));\n    if (!st)\n        return NULL;\n    if (!(st->info = av_mallocz(sizeof(*st->info)))) {\n        av_free(st);\n        return NULL;\n    }\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}']