libavformat/rdt.c:525: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avformat_open_input`.

libavformat/rdt.c:525:15: Call
523.     PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
524. 
525.     int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
                   ^
526.     if (ret < 0) {
527.         av_free(rdt);

libavformat/utils.c:381:1: Parameter `(*ps)->nb_programs`
  379. }
  380. 
  381. int avformat_open_input(AVFormatContext **ps, const char *filename,
       ^
  382.                         AVInputFormat *fmt, AVDictionary **options)
  383. {

libavformat/utils.c:461:5: Call
  459.     if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
  460.         avio_close(s->pb);
  461.     avformat_free_context(s);
           ^
  462.     *ps = NULL;
  463.     return ret;

libavformat/utils.c:2596:1: <LHS trace>
2594. }
2595. 
2596. void avformat_free_context(AVFormatContext *s)
      ^
2597. {
2598.     int i, j;

libavformat/utils.c:2596:1: Parameter `s->nb_programs`
    2594. }
    2595. 
    2596. void avformat_free_context(AVFormatContext *s)
          ^
    2597. {
    2598.     int i, j;

libavformat/utils.c:2629:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_open_input` 
    2627.         av_free(st);
    2628.     }
    2629.     for (i = s->nb_programs - 1; i >= 0; i--) {
                   ^
    2630.         av_dict_free(&s->programs[i]->metadata);
    2631.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i, j;
    AVStream *st;
    av_opt_free(s);
    if (s->iformat && s->iformat->priv_class && s->priv_data)
        av_opt_free(s->priv_data);
    for (i = 0; i < s->nb_streams; i++) {
        st = s->streams[i];
        for (j = 0; j < st->nb_side_data; j++)
            av_freep(&st->side_data[j].data);
        av_freep(&st->side_data);
        st->nb_side_data = 0;
        if (st->parser) {
            av_parser_close(st->parser);
        }
        if (st->attached_pic.data)
            av_free_packet(&st->attached_pic);
        av_dict_free(&st->metadata);
        av_freep(&st->probe_data.buf);
        av_free(st->index_entries);
        av_free(st->codec->extradata);
        av_free(st->codec->subtitle_header);
        av_free(st->codec);
        av_free(st->priv_data);
        av_free(st->info);
        av_free(st);
    }
    for (i = s->nb_programs - 1; i >= 0; i--) {
        av_dict_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    av_freep(&s->priv_data);
    while (s->nb_chapters--) {
        av_dict_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_dict_free(&s->metadata);
    av_freep(&s->streams);
    av_freep(&s->internal);
    av_free(s);
}
['static PayloadContext *\nrdt_new_context (void)\n{\n    PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));\n    int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);\n    if (ret < 0) {\n        av_free(rdt);\n        return NULL;\n    }\n    return rdt;\n}', 'int avformat_open_input(AVFormatContext **ps, const char *filename,\n                        AVInputFormat *fmt, AVDictionary **options)\n{\n    AVFormatContext *s = *ps;\n    int ret = 0;\n    AVDictionary *tmp = NULL;\n    ID3v2ExtraMeta *id3v2_extra_meta = NULL;\n    if (!s && !(s = avformat_alloc_context()))\n        return AVERROR(ENOMEM);\n    if (fmt)\n        s->iformat = fmt;\n    if (options)\n        av_dict_copy(&tmp, *options, 0);\n    if ((ret = av_opt_set_dict(s, &tmp)) < 0)\n        goto fail;\n    if ((ret = init_input(s, filename, &tmp)) < 0)\n        goto fail;\n    if (s->iformat->flags & AVFMT_NEEDNUMBER) {\n        if (!av_filename_number_test(filename)) {\n            ret = AVERROR(EINVAL);\n            goto fail;\n        }\n    }\n    s->duration = s->start_time = AV_NOPTS_VALUE;\n    av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));\n    if (s->iformat->priv_data_size > 0) {\n        if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        if (s->iformat->priv_class) {\n            *(const AVClass **) s->priv_data = s->iformat->priv_class;\n            av_opt_set_defaults(s->priv_data);\n            if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)\n                goto fail;\n        }\n    }\n    if (s->pb)\n        ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);\n    if (s->iformat->read_header)\n        if ((ret = s->iformat->read_header(s)) < 0)\n            goto fail;\n    if (id3v2_extra_meta &&\n        (ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0)\n        goto fail;\n    ff_id3v2_free_extra_meta(&id3v2_extra_meta);\n    if ((ret = queue_attached_pictures(s)) < 0)\n        goto fail;\n    if (s->pb && !s->data_offset)\n        s->data_offset = avio_tell(s->pb);\n    s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;\n    if (options) {\n        av_dict_free(options);\n        *options = tmp;\n    }\n    *ps = s;\n    return 0;\nfail:\n    ff_id3v2_free_extra_meta(&id3v2_extra_meta);\n    av_dict_free(&tmp);\n    if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))\n        avio_close(s->pb);\n    avformat_free_context(s);\n    *ps = NULL;\n    return ret;\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i, j;\n    AVStream *st;\n    av_opt_free(s);\n    if (s->iformat && s->iformat->priv_class && s->priv_data)\n        av_opt_free(s->priv_data);\n    for (i = 0; i < s->nb_streams; i++) {\n        st = s->streams[i];\n        for (j = 0; j < st->nb_side_data; j++)\n            av_freep(&st->side_data[j].data);\n        av_freep(&st->side_data);\n        st->nb_side_data = 0;\n        if (st->parser) {\n            av_parser_close(st->parser);\n        }\n        if (st->attached_pic.data)\n            av_free_packet(&st->attached_pic);\n        av_dict_free(&st->metadata);\n        av_freep(&st->probe_data.buf);\n        av_free(st->index_entries);\n        av_free(st->codec->extradata);\n        av_free(st->codec->subtitle_header);\n        av_free(st->codec);\n        av_free(st->priv_data);\n        av_free(st->info);\n        av_free(st);\n    }\n    for (i = s->nb_programs - 1; i >= 0; i--) {\n        av_dict_free(&s->programs[i]->metadata);\n        av_freep(&s->programs[i]->stream_index);\n        av_freep(&s->programs[i]);\n    }\n    av_freep(&s->programs);\n    av_freep(&s->priv_data);\n    while (s->nb_chapters--) {\n        av_dict_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_dict_free(&s->metadata);\n    av_freep(&s->streams);\n    av_freep(&s->internal);\n    av_free(s);\n}']