libavformat/mov.c:3713: error: Integer Overflow L1
  ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context`.

libavformat/mov.c:3709:9: Call
3707. 
3708.         av_freep(&sc->stereo3d);
3709.         av_freep(&sc->spherical);
              ^
3710.     }
3711. 

libavutil/mem.c:184:26: Assignment
  182. 
  183.     memcpy(&val, arg, sizeof(val));
  184.     memcpy(arg, &(void *){ NULL }, sizeof(val));
                                ^
  185.     av_free(val);
  186. }

libavformat/mov.c:3713:9: Call
3711. 
3712.     if (mov->dv_demux) {
3713.         avformat_free_context(mov->dv_fctx);
              ^
3714.         mov->dv_fctx = NULL;
3715.     }

libavformat/utils.c:2705:1: <LHS trace>
2703. }
2704. 
2705. void avformat_free_context(AVFormatContext *s)
      ^
2706. {
2707.     int i;

libavformat/utils.c:2705:1: Parameter `s->nb_chapters`
  2703. }
  2704. 
  2705. void avformat_free_context(AVFormatContext *s)
        ^
  2706. {
  2707.     int i;

libavformat/utils.c:2726:12: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 
  2724.     av_freep(&s->programs);
  2725.     av_freep(&s->priv_data);
  2726.     while (s->nb_chapters--) {
                   ^
  2727.         av_dict_free(&s->chapters[s->nb_chapters]->metadata);
  2728.         av_free(s->chapters[s->nb_chapters]);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    if (!s)
        return;
    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++)
        free_stream(&s->streams[i]);
    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 int mov_read_close(AVFormatContext *s)\n{\n    MOVContext *mov = s->priv_data;\n    int i, j;\n    for (i = 0; i < s->nb_streams; i++) {\n        AVStream *st = s->streams[i];\n        MOVStreamContext *sc = st->priv_data;\n        av_freep(&sc->ctts_data);\n        for (j = 0; j < sc->drefs_count; j++) {\n            av_freep(&sc->drefs[j].path);\n            av_freep(&sc->drefs[j].dir);\n        }\n        av_freep(&sc->drefs);\n        if (sc->pb && sc->pb != s->pb)\n            ff_format_io_close(s, &sc->pb);\n        av_freep(&sc->chunk_offsets);\n        av_freep(&sc->stsc_data);\n        av_freep(&sc->sample_sizes);\n        av_freep(&sc->keyframes);\n        av_freep(&sc->stts_data);\n        av_freep(&sc->stps_data);\n        av_freep(&sc->rap_group);\n        av_freep(&sc->display_matrix);\n        for (j = 0; j < sc->stsd_count; j++)\n            av_free(sc->extradata[j]);\n        av_freep(&sc->extradata);\n        av_freep(&sc->extradata_size);\n        av_freep(&sc->stereo3d);\n        av_freep(&sc->spherical);\n    }\n    if (mov->dv_demux) {\n        avformat_free_context(mov->dv_fctx);\n        mov->dv_fctx = NULL;\n    }\n    av_freep(&mov->trex_data);\n    return 0;\n}', 'void av_freep(void *arg)\n{\n    void *val;\n    memcpy(&val, arg, sizeof(val));\n    memcpy(arg, &(void *){ NULL }, sizeof(val));\n    av_free(val);\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    if (!s)\n        return;\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        free_stream(&s->streams[i]);\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}']