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

ffmpeg.c:3584:1: start of procedure new_data_stream()
3582. }
3583. 
3584. static void new_data_stream(AVFormatContext *oc, int file_idx)
      ^
3585. {
3586.     AVStream *st;

ffmpeg.c:3588:5: 
3586.     AVStream *st;
3587.     AVOutputStream *ost;
3588.     AVCodec *codec=NULL;
          ^
3589.     AVCodecContext *data_enc;
3590. 

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

ffmpeg.c:3591:5: 
3589.     AVCodecContext *data_enc;
3590. 
3591.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
          ^
3592.     if (!st) {
3593.         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:3592:10: Taking true branch
3590. 
3591.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3592.     if (!st) {
               ^
3593.         fprintf(stderr, "Could not alloc stream\n");
3594.         ffmpeg_exit(1);

ffmpeg.c:3593:9: 
3591.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3592.     if (!st) {
3593.         fprintf(stderr, "Could not alloc stream\n");
              ^
3594.         ffmpeg_exit(1);
3595.     }

ffmpeg.c:3594:9: Skipping ffmpeg_exit(): empty list of specs
3592.     if (!st) {
3593.         fprintf(stderr, "Could not alloc stream\n");
3594.         ffmpeg_exit(1);
              ^
3595.     }
3596.     ost = new_output_stream(oc, file_idx);

ffmpeg.c:3596:5: Skipping new_output_stream(): empty list of specs
3594.         ffmpeg_exit(1);
3595.     }
3596.     ost = new_output_stream(oc, file_idx);
          ^
3597.     data_enc = st->codec;
3598.     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);

ffmpeg.c:3597:5: 
3595.     }
3596.     ost = new_output_stream(oc, file_idx);
3597.     data_enc = st->codec;
          ^
3598.     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
3599.     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}']