avconv.c:172: error: Integer Overflow L1
  ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context`.

avconv.c:160:9: Call
158.         }
159.         av_freep(&fg->outputs);
160.         av_freep(&fg->graph_desc);
             ^
161. 
162.         av_freep(&filtergraphs[i]);

libavutil/mem.c:202:5: Assignment
  200.     void **ptr = (void **)arg;
  201.     av_free(*ptr);
  202.     *ptr = NULL;
           ^
  203. }
  204. 

avconv.c:172:9: Call
170.         if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb)
171.             avio_close(s->pb);
172.         avformat_free_context(s);
             ^
173.         av_dict_free(&of->opts);
174. 

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

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

libavformat/utils.c:2613:12: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 
  2611.     av_freep(&s->programs);
  2612.     av_freep(&s->priv_data);
  2613.     while (s->nb_chapters--) {
                   ^
  2614.         av_dict_free(&s->chapters[s->nb_chapters]->metadata);
  2615.         av_free(s->chapters[s->nb_chapters]);

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 void avconv_cleanup(int ret)\n{\n    int i, j;\n    for (i = 0; i < nb_filtergraphs; i++) {\n        FilterGraph *fg = filtergraphs[i];\n        avfilter_graph_free(&fg->graph);\n        for (j = 0; j < fg->nb_inputs; j++) {\n            av_freep(&fg->inputs[j]->name);\n            av_freep(&fg->inputs[j]);\n        }\n        av_freep(&fg->inputs);\n        for (j = 0; j < fg->nb_outputs; j++) {\n            av_freep(&fg->outputs[j]->name);\n            av_freep(&fg->outputs[j]);\n        }\n        av_freep(&fg->outputs);\n        av_freep(&fg->graph_desc);\n        av_freep(&filtergraphs[i]);\n    }\n    av_freep(&filtergraphs);\n    for (i = 0; i < nb_output_files; i++) {\n        OutputFile *of = output_files[i];\n        AVFormatContext *s = of->ctx;\n        if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb)\n            avio_close(s->pb);\n        avformat_free_context(s);\n        av_dict_free(&of->opts);\n        av_freep(&output_files[i]);\n    }\n    for (i = 0; i < nb_output_streams; i++) {\n        OutputStream *ost = output_streams[i];\n        AVBitStreamFilterContext *bsfc = ost->bitstream_filters;\n        while (bsfc) {\n            AVBitStreamFilterContext *next = bsfc->next;\n            av_bitstream_filter_close(bsfc);\n            bsfc = next;\n        }\n        ost->bitstream_filters = NULL;\n        av_frame_free(&ost->filtered_frame);\n        av_parser_close(ost->parser);\n        av_freep(&ost->forced_keyframes);\n        av_freep(&ost->avfilter);\n        av_freep(&ost->logfile_prefix);\n        av_freep(&output_streams[i]);\n    }\n    for (i = 0; i < nb_input_files; i++) {\n        avformat_close_input(&input_files[i]->ctx);\n        av_freep(&input_files[i]);\n    }\n    for (i = 0; i < nb_input_streams; i++) {\n        InputStream *ist = input_streams[i];\n        av_frame_free(&ist->decoded_frame);\n        av_frame_free(&ist->filter_frame);\n        av_dict_free(&ist->decoder_opts);\n        av_freep(&ist->filters);\n        av_freep(&ist->hwaccel_device);\n        av_freep(&input_streams[i]);\n    }\n    if (vstats_file)\n        fclose(vstats_file);\n    av_free(vstats_filename);\n    av_freep(&input_streams);\n    av_freep(&input_files);\n    av_freep(&output_streams);\n    av_freep(&output_files);\n    uninit_opts();\n    avformat_network_deinit();\n    if (received_sigterm) {\n        av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\\n",\n               (int) received_sigterm);\n        exit (255);\n    }\n}', 'void av_freep(void *arg)\n{\n    void **ptr = (void **)arg;\n    av_free(*ptr);\n    *ptr = NULL;\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}']