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

libavformat/hlsenc.c:205:20: Call
203.                "expect issues decoding it.\n");
204. 
205.     hls->oformat = av_guess_format("mpegts", NULL, NULL);
                        ^
206. 
207.     if (!hls->oformat) {

libavformat/format.c:129:16: Unknown value from: av_guess_format
  127.         av_filename_number_test(filename) &&
  128.         ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {
  129.         return av_guess_format("image2", NULL, NULL);
                      ^
  130.     }
  131. #endif

libavformat/hlsenc.c:242:13: Call
240.         av_free(hls->basename);
241.         if (hls->avf)
242.             avformat_free_context(hls->avf);
                 ^
243.     }
244.     return ret;

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

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

libavformat/utils.c:2622:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context` 
  2620.         av_free(st);
  2621.     }
  2622.     for (i = s->nb_programs - 1; i >= 0; i--) {
                 ^
  2623.         av_dict_free(&s->programs[i]->metadata);
  2624.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    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];
        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_free(s);
}
['static int hls_write_header(AVFormatContext *s)\n{\n    HLSContext *hls = s->priv_data;\n    int ret, i;\n    char *p;\n    const char *pattern = "%d.ts";\n    int basename_size = strlen(s->filename) + strlen(pattern) + 1;\n    hls->number      = 0;\n    hls->recording_time = hls->time * AV_TIME_BASE;\n    hls->start_pts      = AV_NOPTS_VALUE;\n    for (i = 0; i < s->nb_streams; i++)\n        hls->has_video +=\n            s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO;\n    if (hls->has_video > 1)\n        av_log(s, AV_LOG_WARNING,\n               "More than a single video stream present, "\n               "expect issues decoding it.\\n");\n    hls->oformat = av_guess_format("mpegts", NULL, NULL);\n    if (!hls->oformat) {\n        ret = AVERROR_MUXER_NOT_FOUND;\n        goto fail;\n    }\n    hls->basename = av_malloc(basename_size);\n    if (!hls->basename) {\n        ret = AVERROR(ENOMEM);\n        goto fail;\n    }\n    strcpy(hls->basename, s->filename);\n    p = strrchr(hls->basename, \'.\');\n    if (p)\n        *p = \'\\0\';\n    av_strlcat(hls->basename, pattern, basename_size);\n    if ((ret = hls_mux_init(s)) < 0)\n        goto fail;\n    if ((ret = hls_start(s)) < 0)\n        goto fail;\n    if ((ret = avformat_write_header(hls->avf, NULL)) < 0)\n        return ret;\nfail:\n    if (ret) {\n        av_free(hls->basename);\n        if (hls->avf)\n            avformat_free_context(hls->avf);\n    }\n    return ret;\n}', 'AVOutputFormat *av_guess_format(const char *short_name, const char *filename,\n                                const char *mime_type)\n{\n    AVOutputFormat *fmt = NULL, *fmt_found;\n    int score_max, score;\n#if CONFIG_IMAGE2_MUXER\n    if (!short_name && filename &&\n        av_filename_number_test(filename) &&\n        ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {\n        return av_guess_format("image2", NULL, NULL);\n    }\n#endif\n    fmt_found = NULL;\n    score_max = 0;\n    while ((fmt = av_oformat_next(fmt))) {\n        score = 0;\n        if (fmt->name && short_name && !av_strcasecmp(fmt->name, short_name))\n            score += 100;\n        if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))\n            score += 10;\n        if (filename && fmt->extensions &&\n            av_match_ext(filename, fmt->extensions)) {\n            score += 5;\n        }\n        if (score > score_max) {\n            score_max = score;\n            fmt_found = fmt;\n        }\n    }\n    return fmt_found;\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\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        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_free(s);\n}']