ffmpeg.c:512: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avformat_free_context`.

ffmpeg.c:512:9: Call
510.         if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
511.             avio_close(s->pb);
512.         avformat_free_context(s);
             ^
513.         av_free(output_streams_for_file[i]);
514.     }

libavformat/utils.c:2573:1: <LHS trace>
2571. }
2572. 
2573. void avformat_free_context(AVFormatContext *s)
      ^
2574. {
2575.     int i;

libavformat/utils.c:2573:1: Parameter `s->nb_programs`
  2571. }
  2572. 
  2573. void avformat_free_context(AVFormatContext *s)
        ^
  2574. {
  2575.     int i;

libavformat/utils.c:2597:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context` 
  2595.         av_free(st);
  2596.     }
  2597.     for(i=s->nb_programs-1; i>=0; i--) {
                ^
  2598. #if FF_API_OLD_METADATA
  2599.         av_freep(&s->programs[i]->provider_name);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    AVStream *st;
    for(i=0;i<s->nb_streams;i++) {
        st = s->streams[i];
        if (st->parser) {
            av_parser_close(st->parser);
            av_free_packet(&st->cur_pkt);
        }
        av_metadata_free(&st->metadata);
        av_free(st->index_entries);
        av_free(st->codec->extradata);
        av_free(st->codec->subtitle_header);
        av_free(st->codec);
#if FF_API_OLD_METADATA
        av_free(st->filename);
#endif
        av_free(st->priv_data);
        av_free(st->info);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
#if FF_API_OLD_METADATA
        av_freep(&s->programs[i]->provider_name);
        av_freep(&s->programs[i]->name);
#endif
        av_metadata_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--) {
#if FF_API_OLD_METADATA
        av_free(s->chapters[s->nb_chapters]->title);
#endif
        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_metadata_free(&s->metadata);
    av_freep(&s->key);
    av_free(s);
}
['static int ffmpeg_exit(int ret)\n{\n    int i;\n    for(i=0;i<nb_output_files;i++) {\n        AVFormatContext *s = output_files[i];\n        int j;\n        if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)\n            avio_close(s->pb);\n        avformat_free_context(s);\n        av_free(output_streams_for_file[i]);\n    }\n    for(i=0;i<nb_input_files;i++) {\n        av_close_input_file(input_files[i]);\n        av_free(input_files_ts_scale[i]);\n    }\n    av_free(intra_matrix);\n    av_free(inter_matrix);\n    if (vstats_file)\n        fclose(vstats_file);\n    av_free(vstats_filename);\n    av_free(streamid_map);\n    av_free(input_codecs);\n    av_free(output_codecs);\n    av_free(stream_maps);\n    av_free(meta_data_maps);\n    av_free(video_codec_name);\n    av_free(audio_codec_name);\n    av_free(subtitle_codec_name);\n    av_free(video_standard);\n    uninit_opts();\n    av_free(audio_buf);\n    av_free(audio_out);\n    allocated_audio_buf_size= allocated_audio_out_size= 0;\n    av_free(samples);\n#if CONFIG_AVFILTER\n    avfilter_uninit();\n#endif\n    if (received_sigterm) {\n        fprintf(stderr,\n            "Received signal %d: terminating.\\n",\n            (int) received_sigterm);\n        exit (255);\n    }\n    exit(ret);\n    return ret;\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\n    for(i=0;i<s->nb_streams;i++) {\n        st = s->streams[i];\n        if (st->parser) {\n            av_parser_close(st->parser);\n            av_free_packet(&st->cur_pkt);\n        }\n        av_metadata_free(&st->metadata);\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#if FF_API_OLD_METADATA\n        av_free(st->filename);\n#endif\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#if FF_API_OLD_METADATA\n        av_freep(&s->programs[i]->provider_name);\n        av_freep(&s->programs[i]->name);\n#endif\n        av_metadata_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#if FF_API_OLD_METADATA\n        av_free(s->chapters[s->nb_chapters]->title);\n#endif\n        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_metadata_free(&s->metadata);\n    av_freep(&s->key);\n    av_free(s);\n}']